From aae2951d897124e35aa1e99cf4ec077628fd3cf4 Mon Sep 17 00:00:00 2001 From: Ben Pennell Date: Mon, 13 Nov 2023 13:23:42 -0500 Subject: [PATCH] HYC-1813 - Send UnknownFormat errors to 404 page, and specify html format for most errors --- app/controllers/application_controller.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c2b074bc3..5712f9505 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 @@ -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