Class: Glia::Errors::ResourceMinimumNotReachedError

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

Returns a new instance of ResourceMinimumNotReachedError.



198
199
200
201
202
203
204
205
206
207
# File 'lib/glia/errors/client_errors.rb', line 198

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

  super(
    type: RESOURCE_MINIMUM_NOT_REACHED,
    ref: create_ref(RESOURCE_MINIMUM_NOT_REACHED),
    message: message || "#{Naming.humanize(resource)} count must reach at least #{min}",
    error_details: { resource: resource, min: min }
  )
end