Exception
extends Idle
in package
implements
Source
Class \Hoa\Exception\Exception.
Each exception must extend \Hoa\Exception\Exception.
Tags
Table of Contents
Interfaces
- Source
- Interface \Hoa\Event\Source.
Properties
- $_arguments : array<string|int, mixed>
- Arguments to format message.
- $_previous : Exception
- Previous.
- $_rawMessage : string
- Original message.
- $_tmpArguments : array<string|int, mixed>
- Delay processing on arguments.
- $_trace : array<string|int, mixed>
- Backtrace.
Methods
- __construct() : mixed
- Create an exception.
- __toString() : string
- String representation of object.
- enableUncaughtHandler() : mixed
- Enable uncaught exception handler.
- getArguments() : array<string|int, mixed>
- Get arguments for the message.
- getBacktrace() : array<string|int, mixed>
- Get the backtrace.
- getFormattedMessage() : string
- Get the message already formatted.
- getFrom() : string
- Get the source of the exception (class, method, function, main etc.).
- getPreviousThrow() : Exception
- Get previous.
- getRawMessage() : string
- Get the raw message.
- raise() : string
- Raise an exception as a string.
- send() : void
- Send the exception on hoa://Event/Exception.
- uncaught() : void
- Catch uncaught exception (only \Hoa\Exception\Idle and children).
Properties
$_arguments
Arguments to format message.
protected
array<string|int, mixed>
$_arguments
= null
$_previous
Previous.
protected
Exception
$_previous
= null
$_rawMessage
Original message.
protected
string
$_rawMessage
= null
$_tmpArguments
Delay processing on arguments.
protected
array<string|int, mixed>
$_tmpArguments
= null
$_trace
Backtrace.
protected
array<string|int, mixed>
$_trace
= null
Methods
__construct()
Create an exception.
public
__construct(string $message[, int $code = 0 ][, array<string|int, mixed> $arguments = [] ][, Throwable $previous = null ]) : mixed
An exception is built with a formatted message, a code (an ID), and an array that contains the list of formatted string for the message. If chaining, we can add a previous exception.
Parameters
- $message : string
-
Formatted message.
- $code : int = 0
-
Code (the ID).
- $arguments : array<string|int, mixed> = []
-
Arguments to format message.
- $previous : Throwable = null
-
Previous exception in chaining.
__toString()
String representation of object.
public
__toString() : string
Return values
stringenableUncaughtHandler()
Enable uncaught exception handler.
public
static enableUncaughtHandler([bool $enable = true ]) : mixed
This is restricted to Hoa's exceptions only.
Parameters
- $enable : bool = true
-
Enable.
getArguments()
Get arguments for the message.
public
getArguments() : array<string|int, mixed>
Return values
array<string|int, mixed>getBacktrace()
Get the backtrace.
public
getBacktrace() : array<string|int, mixed>
Do not use \Exception::getTrace() any more.
Return values
array<string|int, mixed>getFormattedMessage()
Get the message already formatted.
public
getFormattedMessage() : string
Return values
stringgetFrom()
Get the source of the exception (class, method, function, main etc.).
public
getFrom() : string
Return values
stringgetPreviousThrow()
Get previous.
public
getPreviousThrow() : Exception
Do not use \Exception::getPrevious() any more.
Return values
ExceptiongetRawMessage()
Get the raw message.
public
getRawMessage() : string
Return values
stringraise()
Raise an exception as a string.
public
raise([bool $previous = false ]) : string
Parameters
- $previous : bool = false
-
Whether raise previous exception if exists.
Return values
stringsend()
Send the exception on hoa://Event/Exception.
public
send() : void
uncaught()
Catch uncaught exception (only \Hoa\Exception\Idle and children).
public
static uncaught(Throwable $exception) : void
Parameters
- $exception : Throwable
-
The exception.