class vB_Exception_User extends vB_Exception_Reroute

User Exception Exception thrown specifically to notify the user of an error.

Note: In the case of a user error, the error message will be displayed to the user and so should be both user friendly and localised as a phrase.

Traits

Properties

protected bool $critical Whether the exception is considered as critical by default. from vB_Exception
protected string $option_mail The vb option that decides whether to mail the admin about the exception. from vB_Exception
protected sring $option_log The vb option that decides whether to log the exception. from vB_Exception
protected string $config_debug The vb option that decides whether to debug the exception. from vB_Exception
protected bool $logged Whether the exception has already been logged. from vB_Exception
protected bool $mailed Whether the exception has already been mailed. from vB_Exception
protected string $route_path The route to reroute to. from vB_Exception_Reroute

Methods

__sleep()

No description

__wakeup()

No description

static string
getFullTrace(Exception $e)

Returns the stack trace for an exception

__construct(string $message = false, int $code = false, string $file = false, int $line = false)

Creates a 404 exception with the given message

logError()

Logs details of the error.

mailError()

Sends details of the error to a configured email address.

string
toString(bool $verbose = false)

Creates a string representation of the error.

__toString()

Magic method.

bool
isCritical()

Checks if an exception is considered critical.

string
getRoutePath()

Gets the new route that the exception was thrown with.

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

in vB_Exception at line 102
static string getFullTrace(Exception $e)

Returns the stack trace for an exception

The exception class provides a getTrace and getTraceAsString function, but maddeningly, these do not include the line on which the exception was thrown. This function adds that information the to the string trace and returns it

Declared as as static function so we can use this with other people's exceptions
as well as our own.

Parameters

Exception $e

Return Value

string

at line 37
__construct(string $message = false, int $code = false, string $file = false, int $line = false)

Creates a 404 exception with the given message

Parameters

string $message
  • A description of the error
int $code
  • The PHP code of the error
string $file
  • The file the exception was thrown from
int $line
  • The line the exception was thrown from

in vB_Exception at line 192
logError()

Logs details of the error.

in vB_Exception at line 208
mailError()

Sends details of the error to a configured email address.

in vB_Exception at line 230
string toString(bool $verbose = false)

Creates a string representation of the error.

This is useful when logging or mailing the error and displays full details of the error and where it occurred, including a full stack trace.

Parameters

bool $verbose
  • Whether to display full details

Return Value

string

in vB_Exception at line 255
__toString()

Magic method.

Seperated from toString function because __toString cannot take parameters in 5.3

in vB_Exception at line 267
bool isCritical()

Checks if an exception is considered critical.

Return Value

bool

in vB_Exception_Reroute at line 72
string getRoutePath()

Gets the new route that the exception was thrown with.

Return Value

string
  • The reroute route