ExceptionHandler class final
Central exception → response mapping (ADR-009).
Default rendering produces Laravel-compatible JSON:
{"message": "..."} for HttpExceptions and
{"message": "Server Error"} for everything else (with exception,
file-less trace details when debug is enabled).
Constructors
- ExceptionHandler({Logger? logger})
- A handler reporting to the given logger.
Properties
- debug ↔ bool
-
Whether error responses include the exception and its trace
(
APP_DEBUG); never in production.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
- logger ← Logger
-
Attaches the logger used for default reporting.
no getter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dontReport<
T extends Object> () → void -
Excludes exceptions of type
Tfrom default logging. -
handle(
Object error, StackTrace stackTrace, Request request) → Future< Response> -
Reports then renders
error. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
render<
T extends Object> (ExceptionRenderer< T> renderer) → void -
Registers a renderer for exceptions of type
T(first match wins). -
report<
T extends Object> (ExceptionReporter< T> reporter) → void -
Registers an additional reporter for exceptions of type
T. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- rethrowAttribute → const String
-
Request attribute that makes handle rethrow instead of rendering
(
withoutExceptionHandling()in tests).