Marks all responses with an exception (unless a response was already marked as done)
324301
public void transportClosed() {
        boolean changed=false;

        lock.lock();
        try {
            for(Map.Entry<Address, Rsp<T>> entry: rsps.entrySet()) {
                Rsp<T> rsp=entry.getValue();
                if(rsp != null && !(rsp.wasReceived() || rsp.wasSuspected() || rsp.wasUnreachable())) {
                    rsp.setException(new IllegalStateException("transport was closed"));
                    num_received++;
                    changed=true;
                }
            }
            if(changed && responsesComplete()) {
                complete(this.rsps);
                corrDone();
            }
        }
        finally {
            lock.unlock();
        }
    }
1177113
@RequirePOST
    public HttpResponse doApproveAll() throws IOException {
        StringBuilder buf = new StringBuilder();
        for (Class c : rejected.get()) {
            buf.append(c.getName()).append('\n');
        }
        whitelisted.append(buf.toString());

        return HttpResponses.ok();
    }
814032
private void checkResponse(ResponseDTO response) throws Throwable {
        if (response == null) {
            throw new RpcException("Response should not be null");
        }

        if (response.getError() != null) {
            throw response.getError().getCause();
        }
    }
1002319
private boolean completeResponse(OperationResponse response, Runnable callback) {
    // If the response is null, that indicates an exception occurred. The best we can do is complete
    // the response in sequential order.
    if (response == null) {
      log.trace("Completing failed request");
      callback.run();
      return true;
    }

    // If the response's event index is greater than the current event index, that indicates that events that were
    // published prior to the response have not yet been completed. Attempt to complete pending events.
    if (response.eventIndex() > eventIndex) {
      // For each pending event with an eventIndex less than or equal to the response eventIndex, complete the event.
      // This is safe since we know that sequenced responses should see sequential order of events.
      EventCallback eventCallback = eventCallbacks.peek();
      while (eventCallback != null && eventCallback.request.eventIndex() <= response.eventIndex()) {
        eventCallbacks.remove();
        log.trace("Completing event {}", eventCallback.request);
        eventCallback.run();
        eventIndex = eventCallback.request.eventIndex();
        eventCallback = eventCallbacks.peek();
      }
    }

    // If after completing pending events the eventIndex is greater than or equal to the response's eventIndex, complete the response.
    // Note that the event protocol initializes the eventIndex to the session ID.
    if (response.eventIndex() <= eventIndex || (eventIndex == 0 && response.eventIndex() == state.getSessionId().id())) {
      log.trace("Completing response {}", response);
      callback.run();
      return true;
    } else {
      return false;
    }
  }
693660
function handleResponse(done, err, response, body) {
  if (err) return done(err, null);
  if (response.statusCode !== 200) return done(new Error(body.msg || 'Unknown error'), null);

  done(null, body);
}
109935
@SuppressWarnings("unchecked")
  private <T extends Request> void handleResponse(T request, BiFunction sender, Connection connection, Response response, Throwable error, CompletableFuture future) {
    if (open) {
      if (error == null) {
        if (response.status() == Response.Status.OK
          || response.error() == CopycatError.Type.COMMAND_ERROR
          || response.error() == CopycatError.Type.QUERY_ERROR
          || response.error() == CopycatError.Type.APPLICATION_ERROR
          || response.error() == CopycatError.Type.UNKNOWN_SESSION_ERROR
          || response.error() == CopycatError.Type.INTERNAL_ERROR) {
          LOGGER.trace("{} - Received {}", id, response);
          future.complete(response);
        } else {
          resendRequest(response.error().createException(), request, sender, connection, future);
        }
      } else if (error instanceof ConnectException || error instanceof TimeoutException || error instanceof TransportException || error instanceof ClosedChannelException) {
        resendRequest(error, request, sender, connection, future);
      } else {
        LOGGER.debug("{} - {} failed! Reason: {}", id, request, error);
        future.completeExceptionally(error);
      }
    }
  }
315134
protected void noteError(ServerStats stats, ClientRequest request, Throwable e, long responseTime) {
    	if (stats == null) {
    		return;
    	}
        try {
            recordStats(stats, responseTime);
            RetryHandler errorHandler = getRetryHandler();
            if (errorHandler != null && e != null) {
                if (errorHandler.isCircuitTrippingException(e)) {
                    stats.incrementSuccessiveConnectionFailureCount();                    
                    stats.addToFailureCount();
                } else {
                    stats.clearSuccessiveConnectionFailureCount();
                }
            }
        } catch (Exception ex) {
            logger.error("Error noting stats for client {}", clientName, ex);
        }            
    }
703727
def _make_exception(self, response):
        
        headers = response.headers

        limit_headers = []
        if 'X-Limit-User-Limit' in headers:
            limit_headers = [
                headers['X-Limit-User-Limit'],
                headers['X-Limit-User-Remaining'],
                headers['X-Limit-User-Reset'],
                headers['X-Limit-Key-Limit'],
                headers['X-Limit-Key-Remaining'],
                headers['X-Limit-Key-Reset']
            ]

        x_error_code = int(headers['X-Error-Code'])
        exc = PocketException
        if x_error_code in self.auth_error_codes:
            exc = PocketAutException

        return exc(
            response.status_code,
            x_error_code,
            headers['X-Error'],
            *limit_headers
        )
1188697
void record_task_answer( RPC.RPCCall rpcall ) {
//    assert rpcall._started == 0 || rpcall._dt.hasException();
    rpcall._started = System.currentTimeMillis();
    rpcall._retry = RPC.RETRY_MS; // Start the timer on when to resend
//    AckAckTimeOutThread.PENDING.add(rpcall);
  }
1211009
def _iterator(self, response):
        '''
        
        '''

        while True:
            result = self._parse_data(response)
            bookmark = response.get('bookmark')
            if result:
                for row in result:
                    yield row

                del result

                if not bookmark:
                    break

                response = self._call(bookmark=bookmark)

            else:
                break
1319330
public void setResponse(JsonRpcResponse response) {
    if (response.isError()) {
      setException(response.error());
      return;
    }

    try {
      set((V) Messages.fromJson(method.outputBuilder(), response.result()));
    } catch (Exception e) {
      setException(e);
    }
  }
912156
private static void ensureStatusOk(HttpResponse<String> response) throws ClientErrorException,
            ServerErrorException, OtherCommunicationException {
        int responseStatus = response.getStatus();
        if (isClientError(responseStatus)) {
            throw new ClientErrorException(response.getBody());
        } else if (isServerError(responseStatus)) {
            throw new ServerErrorException();
        } else if (isOtherErrorResponse(responseStatus)) {
            throw new OtherCommunicationException();
        }
    }
1272723
public void markCompleted() throws IOException {
    if (disableHistory) {
      return;
    }
    fileManager.moveToDone(jobId, true, CoronaJobTracker.getMainJobID(jobId));
  }
889328
def set_exception(self, exc_class, exc_info, exc_stack):
        

        if self.is_finished():
            raise InternalError("set_exception called on finished AsynchronousResponse",
                                result=self._result, exception=self._exception)

        self._exception = (exc_class, exc_info, exc_stack)
        self.finish()
852341
public void done(T response) throws IllegalArgumentException {
        lock.lock();
        try {
            if (response != null) {
                this.response = response;
                condition.signal();
            } else {
                throw new IllegalArgumentException("response cannot be null");
            }
        } finally {
            lock.unlock();
        }
    }
1363993
private static void attemptRetryOnException(String logPrefix, Request<?> request,
            VolleyError exception) throws VolleyError {
        RetryPolicy retryPolicy = request.getRetryPolicy();
        int oldTimeout = request.getTimeoutMs();

        try {
            retryPolicy.retry(exception);
        } catch (VolleyError e) {
            request.addMarker(
                    String.format("%s-timeout-giveup [timeout=%s]", logPrefix, oldTimeout));
            throw e;
        }
        request.addMarker(String.format("%s-retry [timeout=%s]", logPrefix, oldTimeout));
    }
1116707
public void onDeleteResponseEvent(ResponseEvent event,
			ActivityContextInterface aci) {
		if (event.getException() != null) {
			if (tracer.isInfoEnabled()) {
				tracer.info("Failed to delete " + event.getURI(),
						event.getException());
			}

			getParent().deleteResponse(event.getURI(), 500, null, null);
		} else {
			final XcapResponse response = event.getResponse();
			if (tracer.isInfoEnabled()) {
				if (response.getCode() == 200) {
					tracer.info("Deleted " + event.getURI() + ". ETag:"
							+ response.getETag());
				} else {
					tracer.info("Failed to delete " + event.getURI()
							+ ". Response: " + response);
				}
			}
			getParent().deleteResponse(event.getURI(), response.getCode(),
					response.getEntity().getContentAsString(),
					response.getETag());
		}
	}