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
Afficher le fichier Open project: simplesamlphp/simplesamlphp Class Usage Examples

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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 méthode

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 méthode

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
Résultat array Array with the variables that should be serialized.

format() public méthode

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

formatBacktrace() public méthode

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.
Résultat array All lines of the backtrace, properly formatted.

fromException() public static méthode

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

getBacktrace() public méthode

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

getCause() public méthode

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

getClass() public méthode

Retrieve the class of this exception.
public getClass ( ) : string
Résultat string The name of the class.

initBacktrace() protected méthode

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

log() public méthode

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 méthode

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

logDebug() public méthode

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

logError() public méthode

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

logInfo() public méthode

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

logWarning() public méthode

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