reject method

void reject(
  1. DioException error, [
  2. bool callFollowingErrorInterceptor = false
])

Completes the request by reject with the error as the result.

Invoking the method will make the rest of interceptors in the queue skipped to handle the request, unless callFollowingErrorInterceptor is true which delivers InterceptorResultType.rejectCallFollowing to the InterceptorState.

Implementation

void reject(
  DioException error, [
  bool callFollowingErrorInterceptor = false,
]) {
  _throwIfCompleted();
  _completer.completeError(
    InterceptorState<DioException>(
      error,
      callFollowingErrorInterceptor
          ? InterceptorResultType.rejectCallFollowing
          : InterceptorResultType.reject,
    ),
    error.stackTrace,
  );
  _processNextInQueue?.call();
}