Exception: Tango::Api::Errors::HttpError

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

Overview

Base HTTP error carrying status, body, request id and optional i18n key.

Direct Known Subclasses

Forbidden, NotFound, RateLimited, ServerError, Unauthorized

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status:, body: nil, request_id: nil, i18n_key: nil) ⇒ HttpError

Returns a new instance of HttpError.



10
11
12
13
14
15
16
# File 'lib/tango/api/errors.rb', line 10

def initialize(message, status:, body: nil, request_id: nil, i18n_key: nil)
  super(message)
  @status = status
  @body = body
  @request_id = request_id
  @i18n_key = i18n_key
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



8
9
10
# File 'lib/tango/api/errors.rb', line 8

def body
  @body
end

#i18n_keyObject (readonly)

Returns the value of attribute i18n_key.



8
9
10
# File 'lib/tango/api/errors.rb', line 8

def i18n_key
  @i18n_key
end

#request_idObject (readonly)

Returns the value of attribute request_id.



8
9
10
# File 'lib/tango/api/errors.rb', line 8

def request_id
  @request_id
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/tango/api/errors.rb', line 8

def status
  @status
end