addError method

  1. @override
void addError(
  1. Object error, [
  2. StackTrace? stackTrace
])
override

Fails done with error. Unless something listens to done, the error is also reported to the current zone (the request's error zone), as nothing else would see it.

Implementation

@override
void addError(Object error, [StackTrace? stackTrace]) {
  var handled = _done != null && !_doneCompleted;
  _completeDone(error, stackTrace);
  if (handled) return;
  if (stackTrace != null) {
    Zone.current.handleUncaughtError(error, stackTrace);
  } else {
    app?.logger.warning('[ResponseContext] stackTrace is null');
  }
}