private void reportBypassedError()

in sdk/core/azure-core-http/src/main/java/com/azure/android/core/http/HttpPipelinePolicyChainImpl.java [284:320]


    private void reportBypassedError(Throwable bypassedError, boolean isErrorFromProceedCallback) {
        HttpPipelinePolicyChainImpl rootChain = this.getRootChain();
        if (rootChain.reportedBypassedError) {
            // We processed escaped error once; after that, any more escaped errors will be rethrown.
            //
            Log.e(TAG, "Error escaped.", bypassedError);
            throw logger.logExceptionAsError(new RuntimeException(bypassedError.getMessage(), bypassedError));
        } else {
            rootChain.reportedBypassedError = true;
            if (isErrorFromProceedCallback) {
                if (this.index > 0) {
                    try {
                        this.rootHttpCallback.onError(bypassedError);
                    } catch (Throwable t) {
                        // :( an error bypassed from the rootCallback.onError(e)
                        Log.e(TAG, "Error escaped from RootCallback::onError(e).", t);
                        throw logger.logExceptionAsError(
                            new RuntimeException("Error escaped from RootCallback::onError(e).", t));
                    }
                } else {
                    assert this.index == 0;
                    // :( an error bypassed from the rootCallback.onError(e)|onSuccess(r)
                    Log.e(TAG, "Error escaped from RootCallback::onError(e)|onSuccess(r).",
                        bypassedError);
                    throw logger.logExceptionAsError(new RuntimeException(bypassedError.getMessage(), bypassedError));
                }
            } else {
                try {
                    this.rootHttpCallback.onError(bypassedError);
                } catch (Throwable t) {
                    Log.e(TAG, "Error escaped from RootCallback::onError(e).", t);
                    throw logger.logExceptionAsError(
                        new RuntimeException("Error escaped from RootCallback::onError(e).", t));
                }
            }
        }
    }