Exception: Subroutine::Auth::NotAuthorizedError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/subroutine/auth.rb

Instance Method Summary collapse

Constructor Details

#initialize(msg = nil) ⇒ NotAuthorizedError

Returns a new instance of NotAuthorizedError.



6
7
8
9
10
# File 'lib/subroutine/auth.rb', line 6

def initialize(msg = nil)
  msg = I18n.t("errors.#{msg}", default: 'Sorry, you are not authorized to perform this action.') if msg.is_a?(Symbol)
  msg ||= I18n.t('errors.unauthorized', default: 'Sorry, you are not authorized to perform this action.')
  super msg
end

Instance Method Details

#statusObject



12
13
14
# File 'lib/subroutine/auth.rb', line 12

def status
  401
end