Exception: Alula::ProcedureError
- Inherits:
-
AlulaError
- Object
- StandardError
- AlulaError
- Alula::ProcedureError
- Defined in:
- lib/alula/errors.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#full_messages ⇒ Object
readonly
Returns the value of attribute full_messages.
Attributes inherited from AlulaError
#error, #http_status, #message, #raw_response
Instance Method Summary collapse
-
#initialize(response) ⇒ ProcedureError
constructor
A new instance of ProcedureError.
-
#ok? ⇒ Boolean
Provides interface mirroring to success responses.
Methods inherited from AlulaError
critical_error_for_response, error_for_response, errors_for_response, for_response
Constructor Details
#initialize(response) ⇒ ProcedureError
Returns a new instance of ProcedureError.
149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/alula/errors.rb', line 149 def initialize(response) # Take 1 error from the request # TODO: Multiple errors are possible, we probably want to shlep that up error = response.data['error'] || response.data['errors'].first @http_status = response.http_status @raw_response = response @error = error['message'] @full_messages = error.dig('data', 'message')&.split(', ') || [error['message']] @message = error['message'] @code = error['code'] end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
147 148 149 |
# File 'lib/alula/errors.rb', line 147 def code @code end |
#full_messages ⇒ Object (readonly)
Returns the value of attribute full_messages.
147 148 149 |
# File 'lib/alula/errors.rb', line 147 def @full_messages end |
Instance Method Details
#ok? ⇒ Boolean
Provides interface mirroring to success responses
165 166 167 |
# File 'lib/alula/errors.rb', line 165 def ok? false end |