Module: Mumuki::Laboratory::Controllers::DynamicErrors

Extended by:
ActiveSupport::Concern
Included in:
ApplicationController
Defined in:
lib/mumuki/laboratory/controllers/dynamic_errors.rb

Instance Method Summary collapse

Instance Method Details

#blocked_forumObject



36
37
38
# File 'lib/mumuki/laboratory/controllers/dynamic_errors.rb', line 36

def blocked_forum
  render 'errors/forbidden', status: 403, locals: { explanation: :blocked_forum_explanation }
end

#forbiddenObject



31
32
33
34
# File 'lib/mumuki/laboratory/controllers/dynamic_errors.rb', line 31

def forbidden
  Rails.logger.info "Access to organization #{Organization.current} was forbidden to user #{current_user} with permissions #{current_user.permissions}"
  render 'errors/forbidden', status: 403, locals: { explanation: :forbidden_explanation }
end

#goneObject



40
41
42
# File 'lib/mumuki/laboratory/controllers/dynamic_errors.rb', line 40

def gone
  render 'errors/gone', status: 410
end

#internal_server_error(exception) ⇒ Object



22
23
24
25
# File 'lib/mumuki/laboratory/controllers/dynamic_errors.rb', line 22

def internal_server_error(exception)
  Rails.logger.error "Internal server error: #{exception} \n#{exception.backtrace.join("\n")}"
  render 'errors/internal_server_error', status: 500
end

#not_foundObject



18
19
20
# File 'lib/mumuki/laboratory/controllers/dynamic_errors.rb', line 18

def not_found
  render 'errors/not_found', status: 404, formats: [:html]
end

#unauthorizedObject



27
28
29
# File 'lib/mumuki/laboratory/controllers/dynamic_errors.rb', line 27

def unauthorized
  render 'errors/unauthorized', status: 401
end