From bf63886de4c7fff252edd1e84b0d836067718354 Mon Sep 17 00:00:00 2001 From: Roger Pack Date: Fri, 23 May 2008 17:16:40 -0600 Subject: [PATCH] adds syntax coloration to rails' error messages, making it easier to read and debug. The filename is shown in red, as well as the line that the error occurred on. --- .../templates/rescues/template_error.erb | 11 +++++++++-- 1 files changed, 9 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 eda64db..c473b71 100644 --- a/actionpack/lib/action_controller/templates/rescues/template_error.erb +++ b/actionpack/lib/action_controller/templates/rescues/template_error.erb @@ -4,12 +4,19 @@

- 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