recordFailure method

void recordFailure(
  1. Object error, {
  2. StackTrace? stackTrace,
  3. String? type,
})

Records a request that failed before any answer arrived.

type overrides what reaches exception.type, for transports whose exceptions are one class covering many causes. Left alone it is the error's runtime type.

An event and no status, matching the Agent's own instrumentation (ADR-0016): a cancellation, a timeout and a refused connection are all recorded the same way, told apart by exception.type. The stack trace is the one thing the Plugin adds that the Agent has none of to give.

Recorded on the request span alone. Putting it on the Request Transaction as well would double every error the Plugin reports.

Implementation

void recordFailure(Object error, {StackTrace? stackTrace, String? type}) {
  _span.recordException(error, stackTrace: stackTrace, type: type);
}