From 506fd8ea57103836c73321ba3cbdefd4846581bb Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 21 Dec 2004 02:05:12 +0000 Subject: 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 --- actionpack/CHANGELOG | 2 ++ actionpack/lib/action_view/template_error.rb | 15 +++++++-------- 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 -- cgit v1.2.3