reject method

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

Complete the request with an error! Other request/response interceptor(s) will not be executed, but error interceptor(s) may be executed, which depends on whether the value of parameter callFollowingErrorInterceptor is true.

error: Error info to reject. callFollowingErrorInterceptor: Whether to call the error interceptor(s).

Implementation

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