Project

General

Profile

Actions

Patch #26341

closed

Add useful details to error message when a template is missing

Added by Vincent Robert almost 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Administration
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

When a template is missing, this message is added to the logs:

Missing template, responding with 404

We could complete this message with useful details. For instance:

Missing partial issues/_list_simple with {:locale=>[:fr, :en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :rsb]}. Searched in:
  * "/redmine/app/views" 

Here is my current patch:

 app/controllers/application_controller.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index a05f54077..a71103a89 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -502,8 +502,8 @@ class ApplicationController < ActionController::Base
   end

   # Handler for ActionView::MissingTemplate exception
-  def missing_template
-    logger.warn "Missing template, responding with 404" 
+  def missing_template(exception)
+    logger.warn "Missing template, responding with 404: #{exception}" 
     @project = nil
     render_404
   end
--


Files

patch.diff (910 Bytes) patch.diff Vincent Robert, 2017-07-04 10:29
Actions

Also available in: Atom PDF