2023-03-09 10:25:57 +01:00
|
|
|
class ErrorsController < ActionController::Base
|
2021-07-19 11:29:44 +02:00
|
|
|
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
|
|
|
|
|
{
|
2022-12-12 14:12:36 +01:00
|
|
|
exception: request.env["action_dispatch.exception"]
|
2021-11-15 14:05:13 +01:00
|
|
|
}.compact
|
|
|
|
|
end
|
|
|
|
|
|
2021-07-19 11:29:44 +02:00
|
|
|
def use_layout
|
|
|
|
|
'only_logo'
|
|
|
|
|
end
|
|
|
|
|
end
|