Skip to content

Commit

Permalink
HYC-1813 - Send UnknownFormat errors to 404 page, and specify html fo…
Browse files Browse the repository at this point in the history
…rmat for most errors
  • Loading branch information
bbpennel committed Nov 13, 2023
1 parent 718882a commit aae2951
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ class ApplicationController < ActionController::Base
rescue_from Hyrax::ObjectNotFoundError, with: :render_404
rescue_from ActiveFedora::ObjectNotFoundError, with: :render_404
rescue_from ActionController::InvalidAuthenticityToken, with: :render_401
rescue_from ActionController::UnknownFormat, with: :render_404

protected

def render_400
render 'errors/not_found', status: 400
render 'errors/not_found', status: 400, formats: :html
end

def render_401
render 'errors/not_found', status: 401
render 'errors/not_found', status: 401, formats: :html
end

def render_riiif_404
Expand All @@ -44,11 +45,11 @@ def render_json_response(response_type: :success, message: nil, options: {})
end

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

def render_500
render 'errors/internal_server_error', status: 500
render 'errors/internal_server_error', status: 500, formats: :html
end

# Error caught in catalogController
Expand Down

0 comments on commit aae2951

Please sign in to comment.