Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: patError

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5

 Class patErrorManager

Description

patErrorManager main error management class used by pat tools for the application-internal error management. Creates patError objects for any errors for precise error management.

  • link: http://www.php-tools.net
  • todo: implement expectError() to ignore an error with a certain code only once.
  • todo: implement ignoreError() to ignore errrors with a certain code
  • license: LGPL
  • author: gERD Schaufelberger <[email protected]>
  • version: 0.3
  • author: Stephan Schmidt <[email protected]>

Located in /pattemplate/patErrorManager.php (line 81)

Class patErrorManager
Method Summary
Static method static boolean addIgnore (mixed $codes)
Static method static boolean clearExpect ()
Static method static boolean clearIgnore ()
Static method static array getExpect ()
Static method static array getIgnore ()
Static method static boolean isError (mixed &$object)
Static method static boolean popExpect ()
Static method static boolean pushExpect (mixed $codes)
Static method static object &raiseError (string $code, string $msg, [mixed $info = null])
Static method static object &raiseNotice (string $code, string $msg, [mixed $info = null])
Static method static object &raiseWarning (string $code, string $msg, [mixed $info = null])
Static method static boolean removeIgnore ( $codes)
Static method static mixed setErrorHandling (int $level, string $mode, [mixed $options = null])
Method array getErrorHandling (int $level)
Method mixed &raise (int $level, string $code, string $msg, [mixed $info = null])
Method boolean registerErrorLevel (integer $level, string $name)
Method boolean setErrorClass (string $name)
Method string translateErrorLevel (integer $level)
Methods
addIgnore (line 407)

add error codes to be ingored

  • return: true on success
  • access: public
boolean addIgnore (mixed $codes)
  • mixed $codes: either an array of error code or a single code that will be ignored in future
clearExpect (line 534)

empty list of errors to be ignored

  • return: true on success
  • access: public
boolean clearExpect ()
clearIgnore (line 471)

empty list of errors to be ignored

  • return: true on success
  • access: public
boolean clearIgnore ()
getErrorHandling (line 352)

retrieves the current error handling settings for the specified error level.

  • return: All error handling details
  • access: public
array getErrorHandling (int $level)
  • int $level: The error level to retrieve. This can be any of PHP's own error levels, e.g. E_ALL, E_NOTICE...
getExpect (line 522)

recieve all registerd error codes that will be ignored

  • return: list of error codes
  • access: public
array getExpect ()
getIgnore (line 459)

recieve all registerd error codes that will be ignored

  • return: list of error codes
  • access: public
array getIgnore ()
isError (line 92)

method for checking whether the return value of a pat application method is a pat error object.

  • return: True if argument is a patError-object, false otherwise.
  • access: public
boolean isError (mixed &$object)
  • mixed &$object
popExpect (line 504)

remove top of error-codes from stack

  • return: true on success
  • access: public
boolean popExpect ()
pushExpect (line 485)

add expected errors to stack

  • return: true on success
  • access: public
boolean pushExpect (mixed $codes)
  • mixed $codes: either an array of error code or a single code that will be ignored in future
raise (line 176)

creates a new patError object given the specified information.

  • return: The configured patError object or false if this error should be ignored
  • todo: implement 'simple' mode that returns just false (BC for patConfiguration)
  • todo: either remove HTML tags and entities from output or test for enviroment!!! in shell is ugly!
  • see: patError
  • access: public
mixed &raise (int $level, string $code, string $msg, [mixed $info = null])
  • int $level: The error level - use any of PHP's own error levels for this: E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE.
  • string $code: The application-internal error code for this error
  • string $msg: The error message, which may also be shown the user if need be.
  • mixed $info: Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
raiseError (line 122)

wrapper for the raise() method where you do not have to specify the error level - a patError object with error level E_ERROR will be returned.

object &raiseError (string $code, string $msg, [mixed $info = null])
  • string $code: The application-internal error code for this error
  • string $msg: The error message, which may also be shown the user if need be.
  • mixed $info: Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
raiseNotice (line 158)

wrapper for the raise() method where you do not have to specify the error level - a patError object with error level E_NOTICE will be returned.

object &raiseNotice (string $code, string $msg, [mixed $info = null])
  • string $code: The application-internal error code for this error
  • string $msg: The error message, which may also be shown the user if need be.
  • mixed $info: Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
raiseWarning (line 140)

wrapper for the raise() method where you do not have to specify the error level - a patError object with error level E_WARNING will be returned.

object &raiseWarning (string $code, string $msg, [mixed $info = null])
  • string $code: The application-internal error code for this error
  • string $msg: The error message, which may also be shown the user if need be.
  • mixed $info: Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
registerErrorLevel (line 243)

register a new error level

This allows you to add custom error levels to the built-in

  • E_NOTICE
  • E_WARNING
  • E_NOTICE
You may use this level in subsequent calls to raise(). Error handling will be set to 'ignore' for the new level, you may change it by using setErrorHandling().

You could be using PHP's predefined constants for error levels or any other integer value.

boolean registerErrorLevel (integer $level, string $name)
  • integer $level: error level
  • string $name: human-readable name
removeIgnore (line 428)

removeIgnore

  • return: true on success
  • access: public
boolean removeIgnore ( $codes)
  • $codes
setErrorClass (line 387)

setErrorClass

In order to autoload this class, the filename containing that class must be named like the class itself; with an appending ".php". Although the file must be stored in the same directory as patErrorManager.php (this file)

  • return: true on success
  • access: public
boolean setErrorClass (string $name)
  • string $name: classname
setErrorHandling (line 280)

sets the way the patErrorManager will handle teh different error levels. Use this if you want to override the default settings.

Error handling modes:

  • ignore
  • trigger
  • verbose
  • echo
  • callback
  • die
You may also set the error handling for several modes at once using PHP's bit operations. Examples:
  • E_ALL = Set the handling for all levels
  • E_ERROR | E_WARNING = Set the handling for errors and warnings
  • E_ALL ^ E_ERROR = Set the handling for all levels except errors

mixed setErrorHandling (int $level, string $mode, [mixed $options = null])
  • int $level: The error level for which to set the error handling
  • string $mode: The mode to use for the error handling.
  • mixed $options: Optional: Any options needed for the given mode.
translateErrorLevel (line 367)

translate an error level

returns the human-readable name for an error level, e.g. E_ERROR will be translated to 'Error'.

  • return: human-readable representation
  • access: public
string translateErrorLevel (integer $level)
  • integer $level: error level

Documentation generated on Mon, 05 Mar 2007 21:13:46 +0000 by phpDocumentor 1.3.1