Exception: Wire::WireError
Overview
WireError is a typed error decoded from the API error envelope ({ “error”: { … } }). It is raised for any non-2xx API response.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#doc_url ⇒ Object
readonly
Returns the value of attribute doc_url.
-
#operator_decline_code ⇒ Object
readonly
Returns the value of attribute operator_decline_code.
-
#param ⇒ Object
readonly
Returns the value of attribute param.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(message, type: "api_error", code: nil, param: nil, request_id: nil, doc_url: nil, operator_decline_code: nil, status_code: nil) ⇒ WireError
constructor
A new instance of WireError.
- #to_s ⇒ Object
Constructor Details
#initialize(message, type: "api_error", code: nil, param: nil, request_id: nil, doc_url: nil, operator_decline_code: nil, status_code: nil) ⇒ WireError
Returns a new instance of WireError.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/wire/errors.rb', line 15 def initialize(, type: "api_error", code: nil, param: nil, request_id: nil, doc_url: nil, operator_decline_code: nil, status_code: nil) super() @type = type @code = code @param = param @request_id = request_id @doc_url = doc_url @operator_decline_code = operator_decline_code @status_code = status_code end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
12 13 14 |
# File 'lib/wire/errors.rb', line 12 def code @code end |
#doc_url ⇒ Object (readonly)
Returns the value of attribute doc_url.
12 13 14 |
# File 'lib/wire/errors.rb', line 12 def doc_url @doc_url end |
#operator_decline_code ⇒ Object (readonly)
Returns the value of attribute operator_decline_code.
12 13 14 |
# File 'lib/wire/errors.rb', line 12 def operator_decline_code @operator_decline_code end |
#param ⇒ Object (readonly)
Returns the value of attribute param.
12 13 14 |
# File 'lib/wire/errors.rb', line 12 def param @param end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
12 13 14 |
# File 'lib/wire/errors.rb', line 12 def request_id @request_id end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
12 13 14 |
# File 'lib/wire/errors.rb', line 12 def status_code @status_code end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
12 13 14 |
# File 'lib/wire/errors.rb', line 12 def type @type end |
Instance Method Details
#to_s ⇒ Object
28 29 30 31 |
# File 'lib/wire/errors.rb', line 28 def to_s "#{super} (type=#{type}, code=#{code}, status=#{status_code}, " \ "request_id=#{request_id})" end |