Exception: Subroutine::Auth::NotAuthorizedError

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

Instance Method Summary collapse

Constructor Details

#initialize(msg = nil) ⇒ NotAuthorizedError

Returns a new instance of NotAuthorizedError.



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

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



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

def status
  401
end