aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-21 02:05:12 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-21 02:05:12 +0000
commit506fd8ea57103836c73321ba3cbdefd4846581bb (patch)
tree49c1aabfdc2b073ca84abbf09323331f80758390
parent6ea54a630a270c7df2c97705e231af64686d2444 (diff)
downloadrails-506fd8ea57103836c73321ba3cbdefd4846581bb.tar.gz
rails-506fd8ea57103836c73321ba3cbdefd4846581bb.tar.bz2
rails-506fd8ea57103836c73321ba3cbdefd4846581bb.zip
Fixed error rendering of rxml documents to not just swallow the exception and return 0 (still not guessing the right line, but hey)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@238 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_view/template_error.rb15
2 files changed, 9 insertions, 8 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index fa9f9ed09d..38010a7434 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed error rendering of rxml documents to not just swallow the exception and return 0 (still not guessing the right line, but hey)
+
* Fixed that textilize and markdown would instantiate their engines even on empty strings. This also fixes #333 [Ulysses]
* Added use of *_before_type_cast for all input and text fields. This is helpful for getting "100,000" back on a integer-based
diff --git a/actionpack/lib/action_view/template_error.rb b/actionpack/lib/action_view/template_error.rb
index 0ac8ee4c37..5fa7f2db5e 100644
--- a/actionpack/lib/action_view/template_error.rb
+++ b/actionpack/lib/action_view/template_error.rb
@@ -49,14 +49,13 @@ module ActionView
end
def line_number
- begin
- @original_exception.backtrace.join.scan(/\((?:erb)\):([0-9]*)/).first.first.to_i
- rescue
- begin
- original_exception.message.scan(/\((?:eval)\):([0-9]*)/).first.first.to_i
- rescue
- 1
- end
+ trace = @original_exception.backtrace.join
+ if trace.include?("erb):")
+ trace.scan(/\((?:erb)\):([0-9]*)/).first.first.to_i
+ elsif trace.include?("eval):")
+ trace.scan(/\((?:eval)\):([0-9]*)/).first.first.to_i
+ else
+ 1
end
end