ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
PEAR_Error Class Reference
+ Inheritance diagram for PEAR_Error:
+ Collaboration diagram for PEAR_Error:

Public Member Functions

 PEAR_Error ($message= 'unknown error', $code=null, $mode=null, $options=null, $userinfo=null)
 PEAR_Error constructor.
 getMode ()
 Get the error mode from an error object.
 getCallback ()
 Get the callback function/method from an error object.
 getMessage ()
 Get the error message from an error object.
 getCode ()
 Get error code from an error object.
 getType ()
 Get the name of this error/exception.
 getUserInfo ()
 Get additional user-supplied information.
 getDebugInfo ()
 Get additional debug information supplied by the application.
 getBacktrace ($frame=null)
 Get the call backtrace from where the error was generated.
 addUserInfo ($info)
 __toString ()
 toString ()
 Make a string representation of this object.

Data Fields

 $error_message_prefix = ''
 $mode = PEAR_ERROR_RETURN
 $level = E_USER_NOTICE
 $code = -1
 $message = ''
 $userinfo = ''
 $backtrace = null

Detailed Description

Definition at line 826 of file PEAR.php.

Member Function Documentation

PEAR_Error::__toString ( )

Definition at line 1055 of file PEAR.php.

References getMessage().

{
return $this->getMessage();
}

+ Here is the call graph for this function:

PEAR_Error::addUserInfo (   $info)

Definition at line 1044 of file PEAR.php.

{
if (empty($this->userinfo)) {
$this->userinfo = $info;
} else {
$this->userinfo .= " ** $info";
}
}
PEAR_Error::getBacktrace (   $frame = null)

Get the call backtrace from where the error was generated.

Supported with PHP 4.3.0 or newer.

Parameters
int$frame(optional) what frame to fetch
Returns
array Backtrace, or NULL if not available. public

Definition at line 1030 of file PEAR.php.

References $backtrace.

{
if (defined('PEAR_IGNORE_BACKTRACE')) {
return null;
}
if ($frame === null) {
}
return $this->backtrace[$frame];
}
PEAR_Error::getCallback ( )

Get the callback function/method from an error object.

Returns
mixed callback function or object/method array public

Definition at line 943 of file PEAR.php.

{
return $this->callback;
}
PEAR_Error::getCode ( )

Get error code from an error object.

Returns
int error code public

Definition at line 972 of file PEAR.php.

References $code.

{
return $this->code;
}
PEAR_Error::getDebugInfo ( )

Get additional debug information supplied by the application.

Returns
string debug information public

Definition at line 1014 of file PEAR.php.

References getUserInfo().

{
return $this->getUserInfo();
}

+ Here is the call graph for this function:

PEAR_Error::getMessage ( )

Get the error message from an error object.

Returns
string full error message public

Definition at line 957 of file PEAR.php.

Referenced by __toString(), and PEAR_Error().

{
return ($this->error_message_prefix . $this->message);
}

+ Here is the caller graph for this function:

PEAR_Error::getMode ( )

Get the error mode from an error object.

Returns
int error mode public

Definition at line 930 of file PEAR.php.

References $mode.

{
return $this->mode;
}
PEAR_Error::getType ( )

Get the name of this error/exception.

Returns
string error/exception name (type) public

Definition at line 986 of file PEAR.php.

{
return get_class($this);
}
PEAR_Error::getUserInfo ( )

Get additional user-supplied information.

Returns
string user-supplied information public

Definition at line 1000 of file PEAR.php.

References $userinfo.

Referenced by getDebugInfo().

{
}

+ Here is the caller graph for this function:

PEAR_Error::PEAR_Error (   $message = 'unknown error',
  $code = null,
  $mode = null,
  $options = null,
  $userinfo = null 
)

PEAR_Error constructor.

Parameters
string$messagemessage
int$code(optional) error code
int$mode(optional) error mode, one of: PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER, PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION
mixed$options(optional) error level, OR in the case of PEAR_ERROR_CALLBACK, the callback function or object/method tuple.
string$userinfo(optional) additional user/debug info

public

Definition at line 861 of file PEAR.php.

References $code, $message, $mode, $userinfo, getMessage(), PEAR\getStaticProperty(), PEAR_ERROR_CALLBACK, PEAR_ERROR_DIE, PEAR_ERROR_EXCEPTION, PEAR_ERROR_PRINT, PEAR_ERROR_RETURN, and PEAR_ERROR_TRIGGER.

Referenced by ilBMFFault\ilBMFFault(), IT_Error\IT_Error(), and MDB2_Error\MDB2_Error().

{
if ($mode === null) {
}
$this->message = $message;
$this->code = $code;
$this->mode = $mode;
$this->userinfo = $userinfo;
if (!PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) {
$this->backtrace = debug_backtrace();
if (isset($this->backtrace[0]) && isset($this->backtrace[0]['object'])) {
unset($this->backtrace[0]['object']);
}
}
$this->level = E_USER_NOTICE;
$this->callback = $options;
} else {
if ($options === null) {
$options = E_USER_NOTICE;
}
$this->level = $options;
$this->callback = null;
}
if ($this->mode & PEAR_ERROR_PRINT) {
if (is_null($options) || is_int($options)) {
$format = "%s";
} else {
$format = $options;
}
printf($format, $this->getMessage());
}
if ($this->mode & PEAR_ERROR_TRIGGER) {
trigger_error($this->getMessage(), $this->level);
}
if ($this->mode & PEAR_ERROR_DIE) {
$msg = $this->getMessage();
if (is_null($options) || is_int($options)) {
$format = "%s";
if (substr($msg, -1) != "\n") {
$msg .= "\n";
}
} else {
$format = $options;
}
die(sprintf($format, $msg));
}
if ($this->mode & PEAR_ERROR_CALLBACK) {
if (is_callable($this->callback)) {
call_user_func($this->callback, $this);
}
}
if ($this->mode & PEAR_ERROR_EXCEPTION) {
trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING);
eval('$e = new Exception($this->message, $this->code);throw($e);');
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PEAR_Error::toString ( )

Make a string representation of this object.

Returns
string a string with an object summary public

Definition at line 1068 of file PEAR.php.

References PEAR_ERROR_CALLBACK, PEAR_ERROR_DIE, PEAR_ERROR_PRINT, PEAR_ERROR_RETURN, and PEAR_ERROR_TRIGGER.

{
$modes = array();
$levels = array(E_USER_NOTICE => 'notice',
E_USER_WARNING => 'warning',
E_USER_ERROR => 'error');
if ($this->mode & PEAR_ERROR_CALLBACK) {
if (is_array($this->callback)) {
$callback = (is_object($this->callback[0]) ?
strtolower(get_class($this->callback[0])) :
$this->callback[0]) . '::' .
$this->callback[1];
} else {
$callback = $this->callback;
}
return sprintf('[%s: message="%s" code=%d mode=callback '.
'callback=%s prefix="%s" info="%s"]',
strtolower(get_class($this)), $this->message, $this->code,
$callback, $this->error_message_prefix,
$this->userinfo);
}
if ($this->mode & PEAR_ERROR_PRINT) {
$modes[] = 'print';
}
if ($this->mode & PEAR_ERROR_TRIGGER) {
$modes[] = 'trigger';
}
if ($this->mode & PEAR_ERROR_DIE) {
$modes[] = 'die';
}
if ($this->mode & PEAR_ERROR_RETURN) {
$modes[] = 'return';
}
return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
'prefix="%s" info="%s"]',
strtolower(get_class($this)), $this->message, $this->code,
implode("|", $modes), $levels[$this->level],
$this->error_message_prefix,
$this->userinfo);
}

Field Documentation

PEAR_Error::$backtrace = null

Definition at line 836 of file PEAR.php.

Referenced by getBacktrace().

PEAR_Error::$code = -1

Definition at line 833 of file PEAR.php.

Referenced by getCode(), ilBMFFault\getFault(), MDB2_Error\MDB2_Error(), and PEAR_Error().

PEAR_Error::$error_message_prefix = ''

Definition at line 830 of file PEAR.php.

Referenced by ilBMFFault\getActor(), and ilBMFFault\getFault().

PEAR_Error::$level = E_USER_NOTICE

Definition at line 832 of file PEAR.php.

Referenced by MDB2_Error\MDB2_Error().

PEAR_Error::$message = ''

Definition at line 834 of file PEAR.php.

Referenced by ilBMFFault\getFault(), and PEAR_Error().

PEAR_Error::$mode = PEAR_ERROR_RETURN

Definition at line 831 of file PEAR.php.

Referenced by getMode(), ilBMFFault\ilBMFFault(), MDB2_Error\MDB2_Error(), and PEAR_Error().

PEAR_Error::$userinfo = ''

Definition at line 835 of file PEAR.php.

Referenced by ilBMFFault\getDetail(), ilBMFFault\getFault(), getUserInfo(), and PEAR_Error().


The documentation for this class was generated from the following file: