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

Changeset 103

Show
Ignore:
Timestamp:
12/09/04 19:48:32 (4 years ago)
Author:
david
Message:

Added breakpoint retries on rescue screens

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/rescue.rb

    r51 r103  
    7575          perform_action_without_rescue 
    7676        rescue => exception 
     77          if defined?(Breakpoint) and @params["BP-RETRY"] then 
     78            msg = exception.backtrace.first 
     79            if md = /^(.+?):(\d+)(?::in `(.+)')?$/.match(msg) then 
     80              origin_file, origin_line = md[1], md[2].to_i 
     81 
     82              set_trace_func(lambda do |type, file, line, method, context, klass| 
     83                if file == origin_file and line == origin_line then 
     84                  set_trace_func(nil) 
     85                  @params["BP-RETRY"] = false 
     86 
     87                  callstack = caller 
     88                  callstack.slice!(0) if callstack.first["rescue.rb"] 
     89                  file, line, method = *callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/).captures 
     90 
     91                  message = "Exception at #{file}:#{line}#{" in `#{method}'" if method}." 
     92 
     93                  Breakpoint.handle_breakpoint(context, message, file, line) 
     94                end 
     95              end) 
     96 
     97              retry 
     98            end 
     99          end 
     100 
    77101          rescue_action(exception) 
    78102        end 
  • trunk/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml

    r51 r103  
     1<% if defined?(Breakpoint) then %><a href="?BP-RETRY=1">Retry with Breakpoint</a><% end %> 
     2 
    13<% 
    24  request_parameters_without_action = @request.parameters.clone