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.



238
239
240
241
242
243
244
245
246
247
248
# File 'lib/glia/errors/client_errors.rb', line 238

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