Class: Glia::Errors::ResourceNotFoundError

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

Returns a new instance of ResourceNotFoundError.



107
108
109
110
111
112
113
114
115
116
# File 'lib/glia/errors/client_errors.rb', line 107

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

  super(
    type: RESOURCE_NOT_FOUND_ERROR,
    ref: "https://example.com/errors/#{RESOURCE_NOT_FOUND_ERROR}.html",
    message: message || "#{humanize(resource)} not found",
    error_details: { resource: resource }
  )
end