class Registry

Flarum's central registry of known error types.

It knows how to deal with errors raised both within Flarum's core and outside of it, map them to error "types" and how to determine appropriate HTTP status codes for them.

Methods

__construct(array $statusMap, array $classMap, array $handlerMap)

No description

handle(Throwable $error)

<p>Map exceptions to handled errors.</p>

Details

__construct(array $statusMap, array $classMap, array $handlerMap)

Parameters

array $statusMap
array $classMap
array $handlerMap

HandledError handle(Throwable $error)

<p>Map exceptions to handled errors.</p>

<p>This can map internal ({\Flarum\Foundation\KnownError}) as well as external exceptions (any classes inheriting from \Throwable) to instances of {\Flarum\Foundation\ErrorHandling\HandledError}.</p> <p>Even for unknown exceptions, a generic fallback will always be returned.</p>

Parameters

Throwable $error

Return Value

HandledError