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

static bool $_display_file =  true [line 81]
static bool $_display_function =  true [line 79]
static bool $_display_title =  true [line 77]
static bool $_display_trace =  true [line 83]
string $_function [line 74]

Class Methods

public static void displayFile ( bool $val ) [line 125]

Displays the function information

Parameter(s):

  • (bool) $val
Implementation of:
Gumbo_Interface_Exception::displayFile()

[ Top ]
public static void displayFunction ( bool $val ) [line 135]

Displays the file information

Parameter(s):

  • (bool) $val
Implementation of:
Gumbo_Interface_Exception::displayFunction()

[ Top ]
public static void displayTitle ( bool $val ) [line 115]

Displays the error title

Parameter(s):

  • (bool) $val
Implementation of:
Gumbo_Interface_Exception::displayTitle()

[ Top ]
public static void displayTrace ( bool $val ) [line 145]

Displays the error trace information

Parameter(s):

  • (bool) $val
Implementation of:
Gumbo_Interface_Exception::displayTrace()

[ Top ]
public Gumbo_Exception __construct ( string $mess, [int $code], [string $file], [int $line], [string $func] ) [line 95]

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 ]
public string getFunction ( ) [line 213]

Returns the function / class method name

Implementation of:
Gumbo_Interface_Exception::getFunction()

[ Top ]
public void setCode ( int $code ) [line 168]

Sets the error level code

Parameter(s):

  • (int) $code
Implementation of:
Gumbo_Interface_Exception::setCode()

[ Top ]
public void setFile ( string $file ) [line 179]

Sets the file name where error occured

Parameter(s):

  • (string) $file
Implementation of:
Gumbo_Interface_Exception::setFile()

[ Top ]
public void setFunction ( string $func ) [line 200]

Sets the function or class method

Parameter(s):

  • (string) $func :: function/method name
Implementation of:
Gumbo_Interface_Exception::setFunction()

[ Top ]
public void setLine ( int $line ) [line 189]

Sets the line number where error occured

Parameter(s):

  • (int) $line
Implementation of:
Gumbo_Interface_Exception::setLine()

[ Top ]
public void setMessage ( string $mess ) [line 158]

Sets the Message text

Parameter(s):

  • (string) $mess
Implementation of:
Gumbo_Interface_Exception::setMessage()

[ Top ]
public string __toString ( ) [line 243]

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 ]