class Taxjar::Error

Constants

BadRequest

Raised when Taxjar endpoint returns the HTTP status code 400

ClientError
ConfigurationError
ERRORS
Forbidden

Raised when Taxjar endpoint returns the HTTP status code 403

Gone

Raised when Taxjar endpoint returns the HTTP status code 410

InternalServerError

Raised when Taxjar endpoint returns the HTTP status code 500

MethodNotAllowed

Raised when Taxjar endpoint returns the HTTP status code 405

NotAcceptable

Raised when Taxjar endpoint returns the HTTP status code 406

NotFound

Raised when Taxjar endpoint returns the HTTP status code 404

ServerError
ServiceUnavailable

Raised when Taxjar endpoint returns the HTTP status code 503

TooManyRequests

Raised when Taxjar endpoint returns the HTTP status code 429

Unauthorized

Raised when Taxjar endpoint returns the HTTP status code 401

UnprocessableEntity

Raised when Taxjar endpoint returns the HTTP status code 422

Attributes

code[R]

Public Class Methods

for_json_parse_error(code) click to toggle source
# File lib/taxjar/error.rb, line 69
def for_json_parse_error(code)
  ServerError.new("Couldn't parse response as JSON.", code)
end
from_response(body) click to toggle source
# File lib/taxjar/error.rb, line 58
def from_response(body)
  code = body[:status]
  message = body[:detail]
  new(message, code)
end
from_response_code(code) click to toggle source
# File lib/taxjar/error.rb, line 64
def from_response_code(code)
  message = HTTP::Response::Status::REASONS[code] || "Unknown Error"
  new(message, code)
end
new(message = '', code = nil) click to toggle source
Calls superclass method
# File lib/taxjar/error.rb, line 75
def initialize(message = '', code = nil)
  super(message)
  @code = code
end