vB_Exception_User
extends vB_Exception_Reroute
in package
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.
Tags
Table of Contents
Methods
- __construct() : mixed
- Creates a 404 exception with the given message
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __toString() : mixed
- Magic method.
- __unserialize() : void
- __wakeup() : void
- getFullTrace() : string
- Returns the stack trace for an exception
- getRoutePath() : string
- Gets the new route that the exception was thrown with.
- isCritical() : bool
- Checks if an exception is considered critical.
- logError() : mixed
- Logs details of the error.
- mailError() : mixed
- Sends details of the error to a configured email address.
- toString() : string
- Creates a string representation of the error.
Methods
__construct()
Creates a 404 exception with the given message
public
__construct([string $message = false ][, int $code = false ][, string $file = false ][, int $line = false ]) : mixed
Parameters
- $message : string = false
-
- A user friendly error
- $code : int = false
-
- The PHP code of the error
- $file : string = false
-
- The file the exception was thrown from
- $line : int = false
-
- The line the exception was thrown from
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__toString()
Magic method.
public
__toString() : mixed
Seperated from toString function because __toString cannot take parameters in 5.3
__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
__wakeup()
public
__wakeup() : void
getFullTrace()
Returns the stack trace for an exception
public
static getFullTrace(Exception $e) : string
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
- $e : Exception
Return values
stringgetRoutePath()
Gets the new route that the exception was thrown with.
public
getRoutePath() : string
Return values
string —- The reroute route
isCritical()
Checks if an exception is considered critical.
public
isCritical() : bool
Return values
boollogError()
Logs details of the error.
public
logError() : mixed
mailError()
Sends details of the error to a configured email address.
public
mailError() : mixed
toString()
Creates a string representation of the error.
public
toString([bool $verbose = false ]) : string
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
- $verbose : bool = false
-
- Whether to display full details