Class: FrederickAPI::V2::Errors::Error
- Inherits:
-
JsonApiClient::Errors::ClientError
- Object
- JsonApiClient::Errors::ClientError
- FrederickAPI::V2::Errors::Error
- Defined in:
- lib/frederick_api/v2/errors/errors.rb
Overview
Base exception class for client errors (i.e. validation, bad request)
Direct Known Subclasses
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(result) ⇒ Error
constructor
Initialize with a JsonApiClient::ResultSet or a Resource.
- #to_s ⇒ Object
Constructor Details
#initialize(result) ⇒ Error
Initialize with a JsonApiClient::ResultSet or a Resource
11 12 13 14 15 |
# File 'lib/frederick_api/v2/errors/errors.rb', line 11 def initialize(result) # @env is used in base class JsonApiClient::Errors::Error @env = result @errors = result.errors || [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
8 9 10 |
# File 'lib/frederick_api/v2/errors/errors.rb', line 8 def errors @errors end |
Instance Method Details
#to_s ⇒ Object
17 18 19 20 |
# File 'lib/frederick_api/v2/errors/errors.rb', line 17 def to_s return "Client Error: #{self.errors.first['detail']}" if self.errors.any? super end |