Exception: Posthubify::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Posthubify::Error
- Defined in:
- lib/posthubify/errors.rb
Overview
Raised when an API request returns a non-2xx status.
begin
ph.posts.get("missing")
rescue Posthubify::Error => e
puts [e.status, e.code, e.].inspect
end
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status, message, code = nil, body = nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(status, message, code = nil, body = nil) ⇒ Error
Returns a new instance of Error.
14 15 16 17 18 19 |
# File 'lib/posthubify/errors.rb', line 14 def initialize(status, , code = nil, body = nil) super() @status = status @code = code @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
12 13 14 |
# File 'lib/posthubify/errors.rb', line 12 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
12 13 14 |
# File 'lib/posthubify/errors.rb', line 12 def code @code end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
12 13 14 |
# File 'lib/posthubify/errors.rb', line 12 def status @status end |