Files
archived-hc-harbor/app/controllers/errors_controller.rb
Echo 64fc0f1f1b better error handling (#677)
* swap honeybadger for sentry

* better error pages
2025-12-01 12:33:01 -05:00

44 lines
1.0 KiB
Ruby

# frozen_string_literal: true
class ErrorsController < ApplicationController
skip_before_action :verify_authenticity_token
def bad_request
@status_code = 400
@title = "Bad Request"
@message = "The server cannot process your request due to invalid syntax."
render_error
end
def not_found
@status_code = 404
@title = "Page Not Found"
@message = "The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved."
render_error
end
def unprocessable_entity
@status_code = 422
@title = "Unprocessable Content"
@message = "The request was well-formed but unable to be followed due to semantic errors."
render_error
end
def internal_server_error
@status_code = 500
@title = "Internal Server Error"
@message = "Something went wrong on our end, but we are looking into it!"
render_error
end
private
def render_error
render "errors/show", status: @status_code, layout: error_layout
end
def error_layout
"errors"
end
end