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.



165
166
167
168
169
170
171
172
# File 'lib/glia/errors/client_errors.rb', line 165

def initialize(resource:, state:, message: nil)
  super(
    type: INVALID_RESOURCE_STATE_ERROR,
    ref: "https://example.com/errors/#{INVALID_RESOURCE_STATE_ERROR}.html",
    message: "#{humanize(resource)} " + (message || "is in invalid state: #{state}"),
    error_details: { resource: resource, state: state }
  )
end