diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-09 19:48:32 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-09 19:48:32 +0000 |
commit | 1b7ea2a50ea2557a30abc04167c1bb13fe0c934a (patch) | |
tree | 80b2c5a868fc204a697d161b2ba3bb977ca23343 /actionpack/lib/action_controller | |
parent | bf0e37b3cf8288779d63e67459bc261b13a13ca3 (diff) | |
download | rails-1b7ea2a50ea2557a30abc04167c1bb13fe0c934a.tar.gz rails-1b7ea2a50ea2557a30abc04167c1bb13fe0c934a.tar.bz2 rails-1b7ea2a50ea2557a30abc04167c1bb13fe0c934a.zip |
Added breakpoint retries on rescue screens
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@103 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/rescue.rb | 24 | ||||
-rw-r--r-- | actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb index 328eca7fe4..e1ba86be6e 100644 --- a/actionpack/lib/action_controller/rescue.rb +++ b/actionpack/lib/action_controller/rescue.rb @@ -74,6 +74,30 @@ module ActionController #:nodoc: begin perform_action_without_rescue rescue => exception + if defined?(Breakpoint) and @params["BP-RETRY"] then + msg = exception.backtrace.first + if md = /^(.+?):(\d+)(?::in `(.+)')?$/.match(msg) then + origin_file, origin_line = md[1], md[2].to_i + + set_trace_func(lambda do |type, file, line, method, context, klass| + if file == origin_file and line == origin_line then + set_trace_func(nil) + @params["BP-RETRY"] = false + + callstack = caller + callstack.slice!(0) if callstack.first["rescue.rb"] + file, line, method = *callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/).captures + + message = "Exception at #{file}:#{line}#{" in `#{method}'" if method}." + + Breakpoint.handle_breakpoint(context, message, file, line) + end + end) + + retry + end + end + rescue_action(exception) end end diff --git a/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml index d1703b0440..c993fb3b19 100644 --- a/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml +++ b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml @@ -1,3 +1,5 @@ +<% if defined?(Breakpoint) then %><a href="?BP-RETRY=1">Retry with Breakpoint</a><% end %> + <% request_parameters_without_action = @request.parameters.clone request_parameters_without_action.delete("action") |