onError method

Called when an exception is thrown.

Implementation

@override
Future<InterceptorResult<RhttpException>> onError(
  RhttpException exception,
) async {
  RhttpException tempException = exception;
  for (final interceptor in interceptors) {
    final result = await interceptor.onError(tempException);
    switch (result) {
      case InterceptorNextResult<RhttpException>():
        tempException = result.value ?? tempException;
      case InterceptorStopResult<RhttpException>():
        return Interceptor.stop(result.value ?? tempException);
      case InterceptorResolveResult<RhttpException>():
        return result;
    }
  }
  return Interceptor.next(tempException);
}