Skip to content

Commit

Permalink
Added breakpoint retries on rescue screens
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@103 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Dec 9, 2004
1 parent bf0e37b commit 1b7ea2a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions actionpack/lib/action_controller/rescue.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -74,6 +74,30 @@ def perform_action_with_rescue #:nodoc:
begin begin
perform_action_without_rescue perform_action_without_rescue
rescue => exception 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) rescue_action(exception)
end end
end end
Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -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 = @request.parameters.clone
request_parameters_without_action.delete("action") request_parameters_without_action.delete("action")
Expand Down

0 comments on commit 1b7ea2a

Please sign in to comment.