-
Notifications
You must be signed in to change notification settings - Fork 0
API: The Error Interface
Adrian edited this page Mar 20, 2024
·
1 revision
Interface for error cases for use by an Exceptable, or as a standalone error value.
-
public __invoke( array $context = [], Throwable $previous = null ) : Exceptable
Factory method: proxies Error::newExceptable(). @see Error::newExceptable() @see https://php.net/__invoke
-
public code() : int
Gets the error code for this case.
-
returns
int
: An error code
-
returns
-
public exceptableType() : string
Gets the name of the proper Exceptable class to throw this Error as.
-
returns
string
: A fully qualified Exceptable classname
-
returns
-
public message( array $context ) : string
Gets the error message for this case, using the given context.
-
parameters:
- array
$context
: Contextual information, used for formatting.
- array
-
returns
string
: An error message
-
parameters:
-
public newExceptable( array $context = [], Throwable $previous = null ) : Exceptable
Factory: creates an Exceptable from this Error case.
-
parameters:
- array
$context
Contextual information, used both for formatting and to pass along to the Exceptable. - Throwable
$previous
: Previous exception, if any.
- array
-
returns
Exceptable
: A new Exceptable using this Error case
-
parameters: