Exception: ActivePostgrest::Error
- Inherits:
-
StandardError
- Object
- StandardError
- ActivePostgrest::Error
- Defined in:
- lib/active_postgrest/errors.rb
Direct Known Subclasses
BadRequest, Conflict, Forbidden, ResourceNotFound, ServerError, Unauthorized, UnprocessableEntity
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#hint ⇒ Object
readonly
Returns the value of attribute hint.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
Instance Method Summary collapse
-
#initialize(response) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(response) ⇒ Error
Returns a new instance of Error.
8 9 10 11 12 13 14 15 |
# File 'lib/active_postgrest/errors.rb', line 8 def initialize(response) body = response.body.is_a?(Hash) ? response.body : {} @http_status = response.status @code = body['code'] @details = body['details'] @hint = body['hint'] super(body['message'] || "HTTP #{response.status}") end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/active_postgrest/errors.rb', line 6 def code @code end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
6 7 8 |
# File 'lib/active_postgrest/errors.rb', line 6 def details @details end |
#hint ⇒ Object (readonly)
Returns the value of attribute hint.
6 7 8 |
# File 'lib/active_postgrest/errors.rb', line 6 def hint @hint end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
6 7 8 |
# File 'lib/active_postgrest/errors.rb', line 6 def http_status @http_status end |