-
Notifications
You must be signed in to change notification settings - Fork 0
API: The Exceptable Interface
Adrian edited this page Mar 27, 2024
·
14 revisions
Augmented interface for exceptional exceptions.
-
public __construct( Error $e = null, array $context = [], Throwable $previous = null )
Object constructor.
-
parameters:
- Error
$e
: The Error case to base the Exceptable on. - array
$context
: Additional error context. - Throwable
$previous
: Previous exception, if any.
- Error
-
parameters:
-
public context() : array
Gets contextual information about the Exceptable.
-
returns
array
: Contextual information provided on construct, as well as the error__message__
and__rootMessage__
.
-
returns
-
public error() : Error
Gets the Exceptable's Error case.
-
returns
Error
-
returns
-
public has( Error $e ) : bool
Does the Exceptable contain the given Error case anywhere in its error chain?
-
parameters:
- Error
$e
: The Error case to compare against
- Error
-
returns
bool
: True if the given Error belongs to the current or a previous Exceptable; false otherwise
-
parameters:
-
public is( Error $e ) : bool
Does the Exceptable match the given Error case?
-
parameters:
- Error
$e
: The Error case to compare against
- Error
-
returns
bool
: True if the given Error belongs to the Exceptable; false otherwise
-
parameters:
-
public root() : Throwable
Traverses the chain of previous exception(s) and gets the root exception. This may be the same as the top-level exception, i.e., if there are no previous exceptions.
-
returns
Throwable
-
returns