Class: Glia::Errors::LimitExceededError

Inherits:
Error
  • Object
show all
Defined in:
lib/glia/errors/client_errors.rb

Constant Summary

Constants inherited from Error

Error::SNAKE_CASE_REGEX

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) ⇒ LimitExceededError

Returns a new instance of LimitExceededError.



151
152
153
154
155
156
157
158
159
160
# File 'lib/glia/errors/client_errors.rb', line 151

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

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