Handles a response error.
345700
private void handleResponseError(long requestId, Throwable error) {
    ContextualFuture future = futures.remove(requestId);
    if (future != null) {
      future.context.execute(() -> future.completeExceptionally(error));
    }
  }
776345
def errorhandle(self, resp):            
        """"""
        if self.format == 'json':
            parsed = xmltodict.parse(resp)
            errors = parsed[self.RESPONSE_TOKEN][self.ERROR_TOKEN]
            # Create list of errors if more than one error response is given
            if type(errors) is list and len(errors) > 1:
                messages = ", ".join([" ".join(["{}: {}".format(k,v) for k, v in e.items()]) for e in errors])
            else:
                overlimit = any('transaction limit' in msg.lower() for msg in errors.values())
                if overlimit:
                    raise APILimitExceeded("This API key has used up its daily quota of calls.")
                else:    
                    messages = " ".join(["{}: {}".format(k,v) for k, v in errors.items()])    
        elif self.format == 'xml':
            import xml.etree.ElementTree as ET
            errors = ET.fromstring(resp).findall(self.ERROR_TOKEN)
            messages = ", ".join(err.find('msg').text for err in errors)
        else:
            raise ValueError("Invalid API response format specified: {}." % self.format)        
        
        raise BustimeError("API returned: {}".format(messages))
60352
def handle_response(response)
      return super(response)
    rescue ActiveResource::ClientError => exc
      begin
        # ugly code to insert the error_message into response
        error_message = "#{format.decode response.body}"
        if not error_message.nil? or error_message == ""
          exc.response.instance_eval do ||
            @message = error_message
          end
        end
      ensure
        raise exc
      end
    end
910369
function responseHandle(error, response, body, reject, resolve) {

    if (error) {
      return reject(error);
    }

    try {
      body = JSON.parse(body);
    } catch (e) {
      return reject(new Error('Wrong JSON Format'));
    }

    resolve(body);
    
  }
750066
protected void throwIfErrorResponse(RESTResponse response) {
        if (response.getCode().isError()) {
            String errMsg = response.getBody();
            if (Utils.isEmpty(errMsg)) {
                errMsg = "Unknown error; response code: " + response.getCode();
            }
            throw new RuntimeException(errMsg);
        }
    }
1103761
protected void handleError(HttpResponse response) throws SmartsheetException {

        com.smartsheet.api.models.Error error;
        try {
            error = this.smartsheet.getJsonSerializer().deserialize(
                    com.smartsheet.api.models.Error.class, response.getEntity().getContent());
        } catch (JsonParseException e) {
            throw new SmartsheetException(e);
        } catch (JsonMappingException e) {
            throw new SmartsheetException(e);
        } catch (IOException e) {
            throw new SmartsheetException(e);
        }

        ErrorCode code = ErrorCode.getErrorCode(response.getStatusCode());

        if (code == null) {
            throw new SmartsheetRestException(error);
        }

        try {
            throw code.getException(error);
        } catch (IllegalArgumentException e) {
            throw new SmartsheetException(e);
        } catch (SecurityException e) {
            throw new SmartsheetException(e);
        }
    }
159651
def handle_response (response):
    
    
    response = json.loads(response.read())
    
    # Was the expression valid?
    if 'error' in response:
        raise ValueError(response['error'])
    else:
        # Some of the strings returned can be parsed to integers or floats
        try:
            return json.loads(response['result'])
        except (TypeError, json.decoder.JSONDecodeError):
            # If the result is NaN, return the actual NaN float
            if response['result'] == 'NaN':
                return float('nan')
            else:
                return response['result']
1337615
function handleError(err) {
  let errMsg = err;

  if (err instanceof Object) {
    errMsg = err.message || err.error || JSON.stringify(err);
  }

  printColumns(chalk.red('Error: ' + errMsg));
  printColumns(
    chalk.white(
      "If you can't settle this, please open an issue at:" + EOL + chalk.cyan(pkg.bugs.url)
    )
  );
  process.exit(1);
}
1060627
protected void handleError(Error error) throws Exception {
    String errMsg="error: "+error.getCode()+" info: "+error.getInfo();
    handleError(errMsg);
  }
1170953
def _method_error_handler(self, response: Dict[str, Any]):
        
        exp = response.get('MESSAGE')
        code = response.get("CODE")
        ID = exp.get("ID")
        raise abort(code, ID=ID, message=exp.get('MESSAGE'))
924120
function handleError(res) {
  return function (err) {
    if (err.status && err.name !== 'NotFoundError') {
      // If we're in this block, the error has a defined `status` property and
      // the error should be directed out immediately
      sendDefaultResponseForCode(err.status, err.message, res);
    } else if (err.name === 'NotFoundError' ||
      err.message.indexOf('ENOENT') !== -1 ||
      err.message.indexOf('not found') !== -1) {
      notFound(err, res);
      // if the word "client" is ever in a message, it should be for the client.  We enforce that here.
    } else if (err.message.indexOf('Client') !== -1) {
      clientError(err, res);
    } else {
      serverError(err, res);
    }
  };
}
146753
protected function handleError($response)
    {
        $message = $response['responseCode'].' ('.$response['errorId'].'): '.$response['message'];
        $this->throwNotSentException($message, $response['errorId']);
    }
1093037
private void handleResponseError(String method, URI uri, Response response)
    {
        if(throwExceptions 
             && response.getStatus() != 200 
             && response.getStatus() != 201 
             && response.getStatus() != 204)
        {
            ErrorResponse error = null;
            if(response.hasEntity())
                error = response.readEntity(ERROR);
            throw new ErrorResponseException(method, response.getStatus(), 
                response.getStatusInfo().getReasonPhrase(), error);
        }
    }
351021
def _handle_error(self, data, params):
        """"""
        error = data.get('error', 'API call failed')
        mode = params.get('mode')
        raise SabnzbdApiException(error, mode=mode)
1254571
def handleError(self, error_code, message):
        ''''''
        self._fail = True
        self.reason = error_code
        self._error = message
232756
function handleCallback(callback, err, httpResponse, body) {

    if(err){
        return callback(err);
    }

    //
    // API returns error
    //
    if( body.status !== 'OK' ){
        return callback(new Error(body.comment));
    }

    return callback(null, body.result);
}
1024698
def handle_error(self, error=None):
        """"""
        if _debug: TCPClientActor._debug("handle_error %r", error)

        # pass along to the director
        if error is not None:
            self.director.actor_error(self, error)
        else:
            TCPClient.handle_error(self)