Class: Glia::Errors::ResourceLimitExceededError

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

Returns a new instance of ResourceLimitExceededError.



185
186
187
188
189
190
191
192
193
194
# File 'lib/glia/errors/client_errors.rb', line 185

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

  super(
    type: RESOURCE_LIMIT_EXCEEDED_ERROR,
    ref: create_ref(RESOURCE_LIMIT_EXCEEDED_ERROR),
    message: message || "#{Naming.humanize(resource)} count must not exceed #{max}",
    error_details: { resource: resource, max: max }
  )
end