Gumbo_Exception
Exception | --Gumbo_Exception
Exception Class
A Gumbo Exception is an extension to the PHP5 Exception class. The extra methods defined allows the programmer to provide special information to the Exception. All Exceptions are defaulted to the ERROR_DEBUG level. This can be defined by the 'code' argument.
The function setting will accept a function name or a class method. This should be set using either __FUNCTION__ or __METHOD__. This element does not need to be set, but useful if thrown inside a function or method.
The Exception contains static methods that are involved with the __toString method. The values determine which pieces are displayed. The __toString method provides an HTML formatted message, with class and id attributes to format the message.
Exceptions should be thrown using try...catch blocks. Once thrown, the file and line number will automatically be set.
try { // test conditions if (failed) { throw new Gumbo_Exception (""); } ... } catch (Gumbo_Exception $e) { $e->setFunction (__METHOD__); gumbo_trigger ($e); }
Exceptions could be created by creating a new Exception object directly. The file and line number may not be set, but the Exception object will still contain a message.
$e = new Gumbo_Exception ("", ERROR_LEVEL, __FILE__, __LINE__, __METHOD__);
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:
Inherited Methods
- constructor __construct ( [$message = ], [$code = ] )
- getCode ( )
- getFile ( )
- getLine ( )
- getMessage ( )
- getTrace ( )
- getTraceAsString ( )
- __clone ( )
- __toString ( )
Class Variables
Class Methods
Displays the function information
Parameter(s):
- (bool) $val
Implementation of:
[ Top ]
Displays the file information
Parameter(s):
- (bool) $val
Implementation of:
[ Top ]
Displays the error title
Parameter(s):
- (bool) $val
Implementation of:
[ Top ]
Displays the error trace information
Parameter(s):
- (bool) $val
Implementation of:
[ Top ]
Constructor
Parameter(s):
- (string) $mess :: Error message
- (int) $code :: Error level code
- (string) $file :: file name
- (int) $line :: line number
- (string) $func :: function/method name
Overrides
- Exception::constructor __construct ( [$message = ], [$code = ] )
[ Top ]
Returns the function / class method name
Implementation of:
[ Top ]
Sets the error level code
Parameter(s):
- (int) $code
Implementation of:
[ Top ]
Sets the file name where error occured
Parameter(s):
- (string) $file
Implementation of:
[ Top ]
Sets the function or class method
Parameter(s):
- (string) $func :: function/method name
Implementation of:
[ Top ]
Sets the line number where error occured
Parameter(s):
- (int) $line
Implementation of:
[ Top ]
Sets the Message text
Parameter(s):
- (string) $mess
Implementation of:
[ Top ]
Returns the Object in string format
The following CSS style rules apply to an Error message
- div.error
- div.error h3 :: Error Title
- div.error p :: Error Message
- div.error p.details :: Error Class::Function and File Name
- div.error ul :: Error Trace details
- div.error ul li :: Trace Line Item
- - *.file :: file name
- - *.line :: file line number
- - *.cls :: class name
- - *.function :: function/method name
- - *.typeArray :: parameter type Array
- - *.typeClass :: parameter type Class
- - *.typeNull :: parameter type null
- - *.typeResource :: parameter type Resource
- - *.typeBoolean :: parameter type Boolean
- - *.typeNumber :: parameter type numeric
- - *.typeString :: parameter type String
Overrides
- Exception::__toString ( )
[ Top ]