Exception: Common::Exceptions::TokenValidationError

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

Overview

Validation Error - an ActiveModel having validation errors, can be sent to this exception

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

Returns a new instance of TokenValidationError.



12
13
14
15
16
17
# File 'lib/common/exceptions/token_validation_error.rb', line 12

def initialize(options = {})
  @code = options[:code] || 401
  @detail = options[:detail]
  @source = options[:source]
  @status = options[:status] || 401
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end

#detailObject (readonly)

Returns the value of attribute detail.



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

def detail
  @detail
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

Instance Method Details

#errorsObject



19
20
21
# File 'lib/common/exceptions/token_validation_error.rb', line 19

def errors
  Array(SerializableError.new(i18n_data.merge(code: @code, detail: @detail, source: @source, status: @status)))
end