2021-07-19 11:29:44 +02:00
|
|
|
class ErrorsController < ::ActionController::Base
|
|
|
|
|
include ErrorsHelper
|
|
|
|
|
include OpenProjectErrorHelper
|
|
|
|
|
include Accounts::CurrentUser
|
|
|
|
|
|
|
|
|
|
def not_found
|
|
|
|
|
render_404
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def unacceptable
|
|
|
|
|
render file: "#{Rails.root}/public/422.html",
|
|
|
|
|
status: :unacceptable,
|
|
|
|
|
layout: false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def internal_error
|
2021-11-15 14:05:13 +01:00
|
|
|
render_500 error_options
|
2021-07-19 11:29:44 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
2021-11-15 14:05:13 +01:00
|
|
|
def error_options
|
|
|
|
|
{
|
|
|
|
|
exception: request.env["action_dispatch.exception"] || request.env["sentry.rescued_exception"]
|
|
|
|
|
}.compact
|
|
|
|
|
end
|
|
|
|
|
|
2021-07-19 11:29:44 +02:00
|
|
|
def use_layout
|
|
|
|
|
'only_logo'
|
|
|
|
|
end
|
|
|
|
|
end
|