Pear
extends HordeException
in package
Horde exception class that converts PEAR errors to exceptions.
This class is strictly legacy support for schematic conversions. It should NOT be used even for new code that happens to interface with PEAR_Error.
Implementation using a custom constructor is dubious. Instead, use a trait that actually unpacks a PEAR_Error into the regular exception constructor.
Tags
Table of Contents
- $details : string
- Error details that should not be part of the main exception message, e.g. any additional debugging information.
- $logged : bool
- Has this exception been logged?
- $_class : string
- The class name for generated exceptions.
- $_logLevel : int
- The log level to use. A Horde_Log constant.
- $extraDetails : string
- $isLogged : bool
- __construct() : mixed
- Exception constructor.
- catchError() : mixed
- Exception handling.
- getDetails() : string
- Get additional details separated from the exception's message
- getLogLevel() : int
- Get the log level.
- isLogged() : bool
- Check if this exception has been logged.
- markAsLogged() : void
- Mark this exception as already logged. This cannot be undone.
- setDetails() : void
- Set additional details separated from the exception's message
- setLogLevel() : void
- Sets the log level.
- _getPearTrace() : string
- Return a trace for the PEAR error.
Properties
$details
Error details that should not be part of the main exception message, e.g. any additional debugging information.
public
string
$details
Tags
$logged
Has this exception been logged?
public
bool
$logged
= false
Tags
$_class
The class name for generated exceptions.
protected
static string
$_class
= __CLASS__
$_logLevel
The log level to use. A Horde_Log constant.
protected
int
$_logLevel
= 0
Name and protected status for legacy reasons. Should rather be private.
$extraDetails
protected
string
$extraDetails
= ''
$isLogged
private
bool
$isLogged
= false
Methods
__construct()
Exception constructor.
public
__construct(PEAR_Error $error) : mixed
Parameters
- $error : PEAR_Error
-
The PEAR error.
Return values
mixed —catchError()
Exception handling.
public
static catchError(mixed $result) : mixed
Parameters
- $result : mixed
-
The result to be checked for a PEAR_Error.
Tags
Return values
mixed —Returns the original result if it was no PEAR_Error.
getDetails()
Get additional details separated from the exception's message
public
getDetails() : string
Return values
string —getLogLevel()
Get the log level.
public
final getLogLevel() : int
Return values
int —The Horde_Log constant for the log level.
isLogged()
Check if this exception has been logged.
public
final isLogged() : bool
Return values
bool —markAsLogged()
Mark this exception as already logged. This cannot be undone.
public
final markAsLogged() : void
Return values
void —setDetails()
Set additional details separated from the exception's message
public
setDetails(string $details) : void
Parameters
- $details : string
Return values
void —setLogLevel()
Sets the log level.
public
final setLogLevel(int|string $level) : void
Parameters
- $level : int|string
-
The log level.
Return values
void —_getPearTrace()
Return a trace for the PEAR error.
private
_getPearTrace(PEAR_Error $error) : string
Parameters
- $error : PEAR_Error
-
The PEAR error.
Return values
string —The backtrace as a string.