Exception: SemaphoreClient::Exceptions::ResponseError
- Defined in:
- lib/semaphore_client/exceptions.rb
Direct Known Subclasses
BadRequest, Conflict, NotAllowed, NotFound, ServerError, Unauthorized, UnprocessableEntity
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
- #body ⇒ Object
- #code ⇒ Object
-
#initialize(env) ⇒ ResponseError
constructor
A new instance of ResponseError.
- #message ⇒ Object
Constructor Details
#initialize(env) ⇒ ResponseError
Returns a new instance of ResponseError.
12 13 14 15 16 |
# File 'lib/semaphore_client/exceptions.rb', line 12 def initialize(env) @env = env super() end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
10 11 12 |
# File 'lib/semaphore_client/exceptions.rb', line 10 def env @env end |
Instance Method Details
#body ⇒ Object
26 27 28 |
# File 'lib/semaphore_client/exceptions.rb', line 26 def body JSON.parse(@env[:body]) end |
#code ⇒ Object
18 19 20 |
# File 'lib/semaphore_client/exceptions.rb', line 18 def code @env[:status] end |
#message ⇒ Object
22 23 24 |
# File 'lib/semaphore_client/exceptions.rb', line 22 def body["message"] if body.is_a?(Hash) end |