OTelErrorHandler typedef

OTelErrorHandler = void Function(Object error, StackTrace? stackTrace)

Signature of a global OpenTelemetry error handler.

Invoked whenever the library suppresses an error that would otherwise have surfaced to the user, per the OpenTelemetry specification (error-handling.md):

OpenTelemetry implementations MUST NOT throw unhandled exceptions at runtime.

SDK implementations MUST allow end users to change the library's default error handling behavior for relevant errors.

error is the suppressed error, typically an ArgumentError or StateError describing the invalid API use. stackTrace is the stack at the point the error was reported, when one is available.

Implementation

typedef OTelErrorHandler = void Function(Object error, StackTrace? stackTrace);