Class: Glia::Errors::ResourceAlreadyExistsError

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

Returns a new instance of ResourceAlreadyExistsError.



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

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

  super(
    type: RESOURCE_ALREADY_EXISTS_ERROR,
    ref: create_ref(RESOURCE_ALREADY_EXISTS_ERROR),
    message: message || "#{Naming.humanize(resource)} already exists",
    error_details: { resource: resource }
  )
end