PHP Class Habari\Error

Inheritance: extends Exception
Mostra file Open project: habari/system

Protected Properties

Property Type Description
$is_error
$message

Public Methods

Method Description
__construct ( string $message = 'Generic Habari Error', integer $code, boolean $is_error = false ) Constructor for the Error class
_n ( $singular, $plural, $count )
_t ( $v )
error_handler ( $errno, $errstr, $errfile, $errline, $errcontext ) Used to handle all PHP errors after Error::handle_errors() is called.
exception_handler ( $exception ) Used to handle all uncaught exceptions.
get ( ) function get
handle_errors ( ) function handle_errors
humane_error ( ) : string Get the error text, file, and line number from the backtrace, which is more accurate
is_error ( $obj ) function is_error
out ( ) function out
raise ( $error_message, $severity = E_USER_ERROR ) function raise
shutdown_handler ( )

Private Methods

Method Description
print_backtrace ( array $trace = null ) Print a backtrace in a format that looks reasonable in both rendered HTML and text

Method Details

__construct() public method

Constructor for the Error class
public __construct ( string $message = 'Generic Habari Error', integer $code, boolean $is_error = false )
$message string Exception to display
$code integer Code of the exception
$is_error boolean true if the exception represents an error handled by the Error class

_n() public method

public _n ( $singular, $plural, $count )

_t() public method

public _t ( $v )

error_handler() public static method

Used to handle all PHP errors after Error::handle_errors() is called.
public static error_handler ( $errno, $errstr, $errfile, $errline, $errcontext )

exception_handler() public static method

Used to handle all uncaught exceptions.
public static exception_handler ( $exception )

get() public method

Returns the error message in plain text
public get ( )

handle_errors() public static method

Configures the Error class to handle all errors.
public static handle_errors ( )

humane_error() public method

Get the error text, file, and line number from the backtrace, which is more accurate
public humane_error ( ) : string
return string The contructed error string

is_error() public static method

Returns true if the argument is an Error instance
public static is_error ( $obj )

out() public method

Outputs the error message in plain text
public out ( )

raise() public static method

Convenience method to create and return a new Error object
public static raise ( $error_message, $severity = E_USER_ERROR )

shutdown_handler() public static method

public static shutdown_handler ( )

Property Details

$is_error protected_oe property

protected $is_error

$message protected_oe property

protected $message