Class \Scrivo\ResourceException

Class to represent an error raised due failure of a server resource.

PHP scripts typically run on a server where the make use of several server resources, for instance:

  • a database connection
  • the file system
  • executable commands

Not to be able to use these resources will generally mean the termination of the script, as errors in the program logic do. You can use these errors to discriminate between resource exceptions, program logic exceptions and application exceptions to take appropriate action: f.i. notify the system admin, send out bug report or prompt the user for new input.

Extends \Exception .
Defined in: ResourceException.php.


Constructor summary

Attr. Name / Description
public

ResourceException($messageOrException, $code, $previous)

Construct a \Scrivo\ResourceException.

 


Constructor

public ResourceException(\Exception $messageOrException=null, int $code=null, \Exception $previous=null)

Construct a \Scrivo\ResourceException.

It is possible to create a \Scrivo\ResourceException based upon an existing exception:

    ....
} catch (\PdoException $e) {
    trhow \Scrivo\ResourceException($e);
}

or use the standard exception parameters:

    ....
} catch (\PdoException $e) {
    trhow \Scrivo\ResourceException("Message", 123, $e);
}

Parameters:

Type Name Def. Description
\Exception $messageOrException null

The error message or original exception.

int $code null

Optional exception code if the first parameter was an error string, else not applicable.

\Exception $previous null

Optional, the original exception if the first parameter was an error string, else not applicable.


Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013