Skip to content

ExceptionCaughtEvent

Emitted by ErrorHandlingMiddleware whenever it catches an unhandled throwable, before rendering the error response.

Lets plugins hook error reporting (e.g. Sentry/Bugsnag) uniformly instead of each wiring its own constructor-injected callback.

final class ExceptionCaughtEvent extends Event

ExtendsEvent
SourceEvent/Lifecycle/ExceptionCaughtEvent.php
PropertyTypeDescription
$exceptionThrowablereadonly.
$requestServerRequestInterfacereadonly.

public function __construct(Throwable $exception, ServerRequestInterface $request): mixed

ParameterTypeDescription
$exceptionThrowable
$requestServerRequestInterface

Returns mixed