Exception: Common::Exceptions::InvalidResource

Inherits:
BaseError
  • Object
show all
Defined in:
lib/common/exceptions/invalid_resource.rb

Overview

Invalid Resource - if a requested route does not exist

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseError

#i18n_data, #i18n_field, #i18n_interpolated, #i18n_key, #log_to_sentry?, #message, #sentry_type, #status_code

Constructor Details

#initialize(resource, options = {}) ⇒ InvalidResource

Returns a new instance of InvalidResource.



12
13
14
15
# File 'lib/common/exceptions/invalid_resource.rb', line 12

def initialize(resource, options = {})
  @resource = resource
  @detail = options[:detail] || i18n_field(:detail, resource: @resource)
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



10
11
12
# File 'lib/common/exceptions/invalid_resource.rb', line 10

def resource
  @resource
end

Instance Method Details

#errorsObject



17
18
19
# File 'lib/common/exceptions/invalid_resource.rb', line 17

def errors
  Array(SerializableError.new(i18n_data.merge(detail: @detail)))
end