Skip to content

API: The Error Interface

Adrian edited this page Mar 20, 2024 · 1 revision

at\exceptable\Error

Interface for error cases for use by an Exceptable, or as a standalone error value.

instance methods

  • Error::__invoke()

    public __invoke( array $context = [], Throwable $previous = null ) : Exceptable
    

    Factory method: proxies Error::newExceptable(). @see Error::newExceptable() @see https://php.net/__invoke

  • Error::code()

    public code() : int
    

    Gets the error code for this case.

    • returns int: An error code
  • Error::exceptableType()

    public exceptableType() : string
    

    Gets the name of the proper Exceptable class to throw this Error as.

    • returns string: A fully qualified Exceptable classname
  • Error::message()

    public message( array $context ) : string
    

    Gets the error message for this case, using the given context.

    • parameters:
      • array $context: Contextual information, used for formatting.
    • returns string: An error message
  • Error::newExceptable

    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.
    • returns Exceptable: A new Exceptable using this Error case