From e1008dcdcd7e946b5f41289a972096087bc616a7 Mon Sep 17 00:00:00 2001 From: Roger Pack Date: Fri, 23 May 2008 15:47:38 -0600 Subject: [PATCH] Made it so that on rails code based error messages, the filename is shown in red, so that people can identify more easily which file they need to go and edit --- .../templates/rescues/template_error.erb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/actionpack/lib/action_controller/templates/rescues/template_error.erb b/actionpack/lib/action_controller/templates/rescues/template_error.erb index eda64db..00fe233 100644 --- a/actionpack/lib/action_controller/templates/rescues/template_error.erb +++ b/actionpack/lib/action_controller/templates/rescues/template_error.erb @@ -4,7 +4,7 @@

- Showing <%=h @exception.file_name %> where line #<%=h @exception.line_number %> raised: + Showing <%=h @exception.file_name %> where line #<%=h @exception.line_number %> raised:

<%=h @exception.message %>

-- 1.5.5.1 From d3a96194ba1355d308db61867966dfa2c8d016ee Mon Sep 17 00:00:00 2001 From: Roger Pack Date: Fri, 23 May 2008 16:32:50 -0600 Subject: [PATCH] also color the line on which the error occurred, and change the file color to brown, which seems nicer on the eyes --- .../templates/rescues/template_error.erb | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_controller/templates/rescues/template_error.erb b/actionpack/lib/action_controller/templates/rescues/template_error.erb index 00fe233..a3aab42 100644 --- a/actionpack/lib/action_controller/templates/rescues/template_error.erb +++ b/actionpack/lib/action_controller/templates/rescues/template_error.erb @@ -4,12 +4,20 @@

- Showing <%=h @exception.file_name %> where line #<%=h @exception.line_number %> raised: + Showing <%=h @exception.file_name %> where line #<%=h @exception.line_number %> raised:

<%=h @exception.message %>

Extracted source (around line #<%=h @exception.line_number %>): -

<%=h @exception.source_extract %>

+<%- line_regex = Regexp.new("^#{@exception.line_number}:") -%> +

+<%-	 @exception.source_extract.each_line do |line|
+	if line =~ line_regex
+		%><%=h line %><%
+	else
+		 %><%=h line %><%
+	end
+  end -%>

<%=h @exception.sub_template_message %>

-- 1.5.5.1 From b09ede9851585aade1cb43ca272b628ad85303d6 Mon Sep 17 00:00:00 2001 From: Roger Pack Date: Fri, 23 May 2008 16:40:04 -0600 Subject: [PATCH] take out extraneous extra first line --- .../templates/rescues/template_error.erb | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_controller/templates/rescues/template_error.erb b/actionpack/lib/action_controller/templates/rescues/template_error.erb index a3aab42..3bde9e0 100644 --- a/actionpack/lib/action_controller/templates/rescues/template_error.erb +++ b/actionpack/lib/action_controller/templates/rescues/template_error.erb @@ -10,8 +10,7 @@

Extracted source (around line #<%=h @exception.line_number %>): <%- line_regex = Regexp.new("^#{@exception.line_number}:") -%> -


-<%-	 @exception.source_extract.each_line do |line|
+
<%-	 @exception.source_extract.each_line do |line|
 	if line =~ line_regex
 		%><%=h line %><%
 	else
-- 
1.5.5.1