TryCatchHandler class

An Handler wrapper which calls the wrapped handler and does the following:

  • when an instance of Response is returned or thrown by the wrapped handler, the response is returned
  • when another error is thrown by the wrapped handler and the onError callback is set, the error will be converted to a response
  • otherwise the error will be rethrown.

Constructors

TryCatchHandler(Handler wrapped, {Future<Response> onError(dynamic, StackTrace)?})

Properties

hashCode int
The hash code for this object.
no setterinherited
onError → (Future<Response> Function(dynamic, StackTrace)?)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
wrapped → Handler
final

Methods

handle(Request request) Future<Response>
Handles the request and returns a Response.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited