ErrorHandler typedef

ErrorHandler = FutureOr Function(Object error, StackTrace stackTrace, Context ctx)

A function that handles errors during request processing.

Receives the error, stack trace, and context to allow custom error responses.

Example:

app.onError((error, stackTrace, ctx) {
  print('Error: $error');
  return {'error': error.toString()};
});

Implementation

typedef ErrorHandler =
    FutureOr<dynamic> Function(
      Object error,
      StackTrace stackTrace,
      Context ctx,
    );