Exception: Oauth2ApiClient::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/oauth2_api_client/errors.rb

Overview

The ResponseError class is the main exception class of Oauth2ApiClient and is raised when a request fails with some status code other than 2xx. Using the exception object, you still have access to the response. Moreover, there are exception classes for all 4xx and 5xx errors.

Examples:

begin
  client.post("/orders", json: { address: "..." })
rescue Oauth2ApiClient::ResponseError::NotFound => e
  e.response # => HTTP::Response
rescue Oauth2ApiClient::ResponseError::BadRequest => e
  # ...
rescue Oauth2ApiClient::ResponseError => e
  # ...
end

Direct Known Subclasses

ResponseError