addError method
Fails the response: dart:io closes the connection abruptly for an
error added to the HttpResponse, so the response is closed, and the
error is reported as ResponseContext.addError does.
Implementation
@override
void addError(Object error, [StackTrace? stackTrace]) {
if (!_isDetached && !_isClosed) {
_isClosed = true;
rawResponse.addError(abortErrorOf(error), stackTrace);
// Its failure is this error, reported below, not another.
rawResponse.done.then((_) {}, onError: (_) {});
}
super.addError(error, stackTrace);
}