Zeta Components Manual :: Docs For Class ezcExecution
Execution::ezcExecution
Class ezcExecution
Class for handling fatal errors
This class allows you to invoke a handler whenever a fatal error occurs, or when an uncatched exception happens. You can specify which callback function to use and signal whether your application cleanly exited.
Example:
- <?php
- {
- public static function onError( Exception $exception = null )
- {
- echo "Error!\n";
- // If you want, you can use the parent's onError method, but that
- // will only show a standard message.
- parent::onError( $exception );
- }
- }
- // ....
- ?>
Source for this file: /Execution/src/execution.php
Version: | //autogentag// |
Method Summary
public static void |
cleanExit(
)
Marks the current application as cleanly-exited. |
public static void |
exceptionCallbackHandler(
$e
)
Handler for uncaught exceptions. |
public static void |
init(
$callbackClassName
)
Initializes the ezcExecution environment. |
public static void |
reset(
)
Resets the ezcExecution environment. |
public static void |
shutdownCallbackHandler(
)
Shutdown handler |
Methods
cleanExit
Marks the current application as cleanly-exited.
With this method you signal the ezcExecution environment that your application ended without errors. This is usually done just before you reach the end of your script, or just before you call exit() or die().
Exceptions:
Type | Description |
---|---|
ezcExecutionNotInitializedException |
if the environment was not yet initialized. |
exceptionCallbackHandler
Handler for uncaught exceptions.
The ezcExecution environment installs this method as handler for uncaught exceptions and will be called when one is found. This method's only function is to call the ::onError() static method of the error handler set with the init() method. It passes along the uncaught exception to this method.
This method has to be public otherwise PHP can not call it, but you should never call this method yourself.
Parameters:
Name | Type | Description |
---|---|---|
$e |
Exception |
init
Initializes the ezcExecution environment.
With this method you initialize the ezcExecution environment. You need to specify a class name $callBackClassName that will be used to call the onError() method on in case of an error. The class name that you pass should implement the ezcExecutionErrorHandler interface. This method takes care of registering the uncaught exception and shutdown handlers.
Parameters:
Name | Type | Description |
---|---|---|
$callbackClassName |
string |
Exceptions:
Type | Description |
---|---|
ezcExecutionAlreadyInitializedException |
if the environment was already initialized. |
ezcExecutionInvalidCallbackException |
if an unknown callback class was passed. |
ezcExecutionWrongClassException |
if an invalid callback class was passed. |
reset
Resets the ezcExecution environment.
With this function you reset the environment. Usually this method should not be used, but in the cases when you want to restart the environment this is the method to use. It also takes care of restoring the user defined uncaught exception handler, but it can not undo the registered shutdown handler as PHP doesn't provide that functionality.
shutdownCallbackHandler
Shutdown handler
The ezcExecution environment installs this method as general shutdown handler. This method's only function is to call the ::onError() static method of the error handler set with the init() method.