Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8743

Show
Ignore:
Timestamp:
01/27/08 20:45:35 (7 months ago)
Author:
nzkoz
Message:

Precalculate the Backtrace of a template error to avoid raising exceptions in TemplateError#backtrace. These will abort the ruby vm. Closes #10936 [Aleksey Kondratenko]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_view/template_error.rb

    r8210 r8743  
    1111        base_path, assigns.dup, source, original_exception 
    1212      @file_path = file_path 
     13      @backtrace = compute_backtrace 
    1314    end 
    1415 
     
    7374    end 
    7475 
     76    # don't do anything nontrivial here. Any raised exception from here becomes fatal  
     77    # (and can't be rescued). 
    7578    def backtrace 
    76       [ 
    77         "#{source_location.capitalize}\n\n#{source_extract(4)}\n    " + 
    78         clean_backtrace.join("\n    ") 
    79       ] 
     79      @backtrace 
    8080    end 
    8181 
    8282    private 
     83      def compute_backtrace 
     84        [ 
     85          "#{source_location.capitalize}\n\n#{source_extract(4)}\n    " + 
     86          clean_backtrace.join("\n    ") 
     87        ] 
     88      end 
     89 
    8390      def strip_base_path(path) 
    8491        stripped_path = File.expand_path(path).gsub(@base_path, "")