Class: Glia::Errors::InvalidResourceStateError

Inherits:
Error
  • Object
show all
Defined in:
lib/glia/errors/client_errors.rb

Instance Attribute Summary

Attributes inherited from Error

#error_details, #message, #ref, #type

Instance Method Summary collapse

Methods inherited from Error

#to_h

Constructor Details

#initialize(resource:, state:, message: nil) ⇒ InvalidResourceStateError

Returns a new instance of InvalidResourceStateError.



224
225
226
227
228
229
230
231
232
233
234
# File 'lib/glia/errors/client_errors.rb', line 224

def initialize(resource:, state:, message: nil)
  Naming.assert_snake_case(resource)
  Naming.assert_snake_case(state)

  super(
    type: INVALID_RESOURCE_STATE_ERROR,
    ref: create_ref(INVALID_RESOURCE_STATE_ERROR),
    message: message || "#{Naming.humanize(resource)} is in invalid state: #{state}",
    error_details: { resource: resource, state: state }
  )
end