Exception: Common::Exceptions::Unauthorized

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

Overview

Unauthorized - We may eventually want different variations on this with distinct MinorCodes

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(options = {}) ⇒ Unauthorized

Returns a new instance of Unauthorized.



10
11
12
13
14
# File 'lib/common/exceptions/unauthorized.rb', line 10

def initialize(options = {})
  @detail = options[:detail]
  @source = options[:source]
  @errors = options[:errors]
end

Instance Method Details

#errorsObject



16
17
18
19
20
# File 'lib/common/exceptions/unauthorized.rb', line 16

def errors
  return @errors if @errors.present?

  Array(SerializableError.new(i18n_data.merge(detail: @detail, source: @source)))
end