PEAR_Error

(unknown)

PEAR_Error -- PEAR error mechanism base class

Synopsis

$err = new PEAR_Error($msg);

Error Modes

An error object has a mode of operation that can be set with one of the following constants:

PEAR_ERROR_RETURN

Just return the object, don't do anything special in PEAR_Error's constructor.

PEAR_ERROR_PRINT

Print the error message in the constructor. The execution is not interrupted.

PEAR_ERROR_TRIGGER

Use PHP's trigger_error() function to raise an internal error in PHP. The execution is aborted if you have defined your own PHP error handler or if you set the error severity to E_USER_ERROR.

PEAR_ERROR_DIE

Print the error message and exit. Execution is of course aborted.

PEAR_ERROR_CALLBACK

Use a callback function or method to handle errors. Execution is aborted.

Properties

Methods

PEAR_Error::PEAR_Error ([message code mode options userinfo]]]]])

Description

PEAR_Error constructor. Parameters:

message

error message, defaults to "unknown error"

code

error code (optional)

mode

Mode of operation. See the error modes section for details.

options

If the mode of can have any options specified, use this parameter. Currently the "trigger" and "callback" modes are the only using the options parameter. For trigger mode, this parameter is one of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR. For callback mode, this parameter should contain either the callback function name (string), or a two-element (object, string) array representing an object and a method name.