Gumbo_Error_Handler
Error Handler Class
This class will process any Exceptions thrown by the program. Any thrown Exceptions should be sent to the Exception Handler through the trigger method. This can be done either by sending a thrown Exception to the handler, creating a new Exception and sending the object to trigger, or by using the trigger_error() function.
try { if ( // test condition failes ) { throw new Gumbo_Exception ("message"); } // successful test ... } catch (Exception $e) { if ($e instanceof Gumbo_Interface_Exception) { $e->setFunction (__METHOD__); } Gumbo_Error_Handler::trigger ($e); }
$e = new Gumbo_Exception ("message", ERROR_LEVEL, __FILE__, __LINE__, __METHOD__); Gumbo_Error_Handler::trigger ($e);
trigger_error ("message", ERROR_LEVEL);
The class file provides a simple function that wraps the trigger method. This function is simply called 'trigger (...)'. This will help from having to type the entire static class method.
... trigger ($e);
Author(s): |
Michael Luster <mluster79@yahoo.com> |
License: | New BSD License |
Copyright: | Copyright (c) 2007, iBayou, Michael Luster |
Link: | http://sourceforge.net/projects/phpgumbo |
Version: | 0.0.1 |
Implements interfaces:
Class Methods
public static void activate ( )
[line 124]
Activates this class as the system Error Handler to the trigger method
Implementation of:
[ Top ]
public static void reset ( )
[line 134]
Restores the system Error Handlers
- postcondition:
restore_error_handler () - postcondition:
restore_exception_handler () Implementation of:
[ Top ]public static void trigger ( int|Exception $errno, [string $errstr], [string $errfile], [int $errline], [string $errfunc] ) [line 83]Catches an Error triggered by the program
Parameter(s):
- (int|Exception) $errno :: Error code (trigger_error), Exception object
- (string) $errstr :: Error message, Exception class name
- (string) $errfile :: location of Error occurence
- (int) $errline :: line number Error occured
- (string) $errfunc :: function or class::method where error occured
- uses:
Gumbo_Exception, - Gumbo_Error Implementation of:
[ Top ]