PHP Class SimpleSAML_Error_Exception, simplesamlphp

This class tries to make sure that every exception is serializable.
Author: Thomas Graff ([email protected])
Inheritance: extends Exception
Exibir arquivo Open project: simplesamlphp/simplesamlphp Class Usage Examples

Public Methods

Method Description
__construct ( string $message, integer $code, Exception $cause = null ) Constructor for this error.
__sleep ( ) : array Function for serialization.
format ( boolean $anonymize = false ) : array Format this exception for logging.
formatBacktrace ( boolean $anonymize = false ) : array Format the backtrace for logging.
fromException ( Exception $e ) : SimpleSAML_Error_Exception Convert any exception into a SimpleSAML_Error_Exception.
getBacktrace ( ) : array Retrieve the backtrace.
getCause ( ) : SimpleSAML_Error_Exception | null Retrieve the cause of this exception.
getClass ( ) : string Retrieve the class of this exception.
log ( integer $default_level ) Print the exception to the log, by default with log level error.
logDebug ( ) Print the exception to the log with log level debug.
logError ( ) Print the exception to the log with log level error.
logInfo ( ) Print the exception to the log with log level info.
logWarning ( ) Print the exception to the log with log level warning.

Protected Methods

Method Description
initBacktrace ( Exception $exception ) Load the backtrace from the given exception.
logBacktrace ( $level = SimpleSAML\Logger::DEBUG ) Print the backtrace to the log if the 'debug' option is enabled in the configuration.

Method Details

__construct() public method

Note that the cause will be converted to a SimpleSAML_Error_UnserializableException unless it is a subclass of SimpleSAML_Error_Exception.
public __construct ( string $message, integer $code, Exception $cause = null )
$message string Exception message
$code integer Error code
$cause Exception The cause of this exception.

__sleep() public method

This function builds a list of all variables which should be serialized. It will serialize all variables except the Exception::trace variable.
public __sleep ( ) : array
return array Array with the variables that should be serialized.

format() public method

Create an array of lines for logging.
public format ( boolean $anonymize = false ) : array
$anonymize boolean Whether the resulting messages should be anonymized or not.
return array Log lines that should be written out.

formatBacktrace() public method

Create an array of lines for logging from the backtrace.
public formatBacktrace ( boolean $anonymize = false ) : array
$anonymize boolean Whether the resulting messages should be anonymized or not.
return array All lines of the backtrace, properly formatted.

fromException() public static method

Convert any exception into a SimpleSAML_Error_Exception.
public static fromException ( Exception $e ) : SimpleSAML_Error_Exception
$e Exception The exception.
return SimpleSAML_Error_Exception The new exception.

getBacktrace() public method

Retrieve the backtrace.
public getBacktrace ( ) : array
return array An array where each function call is a single item.

getCause() public method

Retrieve the cause of this exception.
public getCause ( ) : SimpleSAML_Error_Exception | null
return SimpleSAML_Error_Exception | null The cause of this exception.

getClass() public method

Retrieve the class of this exception.
public getClass ( ) : string
return string The name of the class.

initBacktrace() protected method

Load the backtrace from the given exception.
protected initBacktrace ( Exception $exception )
$exception Exception The exception we should fetch the backtrace from.

log() public method

Override to allow errors extending this class to specify the log level themselves.
public log ( integer $default_level )
$default_level integer The log level to use if this method was not overridden.

logBacktrace() protected method

Print the backtrace to the log if the 'debug' option is enabled in the configuration.
protected logBacktrace ( $level = SimpleSAML\Logger::DEBUG )

logDebug() public method

This function will write this exception to the log, including a full backtrace.
public logDebug ( )

logError() public method

This function will write this exception to the log, including a full backtrace.
public logError ( )

logInfo() public method

This function will write this exception to the log, including a full backtrace.
public logInfo ( )

logWarning() public method

This function will write this exception to the log, including a full backtrace.
public logWarning ( )