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)

Map exceptions to handled errors.

Details

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

Parameters

array $statusMap
array $classMap
array $handlerMap

HandledError handle(Throwable $error)

Map exceptions to handled errors.

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

Parameters

Throwable $error

Return Value

HandledError