Exception: JsonapiErrorsHandler::Errors::Unauthorized

Inherits:
StandardError
  • Object
show all
Defined in:
lib/jsonapi_errors_handler/errors/unauthorized.rb

Overview

Handles serialization of Unauthorized HTTP error (401 status code)

Instance Attribute Summary

Attributes inherited from StandardError

#detail, #source, #status, #title

Instance Method Summary collapse

Methods inherited from StandardError

#serializable_hash, #to_h, #to_s

Constructor Details

#initialize(message: nil) ⇒ Unauthorized

Returns a new instance of Unauthorized.



8
9
10
11
12
13
14
15
# File 'lib/jsonapi_errors_handler/errors/unauthorized.rb', line 8

def initialize(message: nil)
  super(
    title: 'Unauthorized',
    status: 401,
    detail: message || 'You need to login to authorize this request.',
    source: { pointer: '/request/headers/authorization' }
  )
end