HandleUncaughtErrorHandler typedef

HandleUncaughtErrorHandler = void Function(Zone self, ZoneDelegate parent, Zone zone, Object error, StackTrace stackTrace)

The type of a custom Zone.handleUncaughtError implementation function.

Receives the Zone that the handler was registered on as self, a delegate forwarding to the handlers of self's parent zone as parent, and the current zone where the error was uncaught as zone, which will have self as a parent zone.

The error and stackTrace are the error and stack trace that was uncaught in zone.

The function must only access zone-related functionality through self, parent or zone. It should not depend on the current zone (Zone.current).

If the uncaught error handler throws, the error will be passed to parent.handleUncaughtError. If the thrown object is error, the throw is considered a re-throw and the original stackTrace is retained. This allows an asynchronous error to leave the error zone.

Implementation

typedef HandleUncaughtErrorHandler =
    void Function(
      Zone self,
      ZoneDelegate parent,
      Zone zone,
      Object error,
      StackTrace stackTrace,
    );