Exception: Alula::ProcedureError

Inherits:
AlulaError
  • Object
show all
Defined in:
lib/alula/errors.rb

Instance Attribute Summary collapse

Attributes inherited from AlulaError

#error, #http_status, #message, #raw_response

Instance Method Summary collapse

Methods inherited from AlulaError

for_response

Constructor Details

#initialize(response) ⇒ ProcedureError

Returns a new instance of ProcedureError.



186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/alula/errors.rb', line 186

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

#codeObject (readonly)

Returns the value of attribute code.



184
185
186
# File 'lib/alula/errors.rb', line 184

def code
  @code
end

#full_messagesObject (readonly)

Returns the value of attribute full_messages.



184
185
186
# File 'lib/alula/errors.rb', line 184

def full_messages
  @full_messages
end

Instance Method Details

#ok?Boolean

Provides interface mirroring to success responses

Returns:

  • (Boolean)


202
203
204
# File 'lib/alula/errors.rb', line 202

def ok?
  false
end