Class: Glia::Errors::ResourceLockedError

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:, locked_by: nil, message: nil) ⇒ ResourceLockedError

Returns a new instance of ResourceLockedError.



211
212
213
214
215
216
217
218
219
220
221
# File 'lib/glia/errors/client_errors.rb', line 211

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

  is_locked_by = locked_by.nil? ? '' : "Locked by: #{locked_by}"
  super(
    type: RESOURCE_LOCKED,
    ref: create_ref(RESOURCE_LOCKED),
    message: message || "#{Naming.humanize(resource)} is locked. #{is_locked_by}",
    error_details: { resource: resource, locked_by: locked_by }
  )
end