0

I'd like to be able to set conditional breakpoints in ruby-debug, where the condition is "An exception was thrown."

What I'd like is the ability to land on a breakpoint whenever an exception is thrown on that line (a la MATLAB's ultra-convenient dbstop if error option illustrated here).

Thanks in advance.

Manu R
  • 806
  • 1
  • 8
  • 13

1 Answers1

1

the example you provided "debugger if XXXXX" should work fine.

if the statement debugger works for you, there is no reason

if some_condition
debugger
end

would not, and that is basically what your line does. I do this all the time and it works fine.

for breaking on exceptions, you can override the class Exception and put the debugger statement in the initializer method.

Kalendae
  • 2,256
  • 1
  • 21
  • 23
  • You are right, thanks for the prompt response. I must have been doing something weird the last time I tried that. I've revised my question to be just the "debugger if an exception is raised" feature. – Manu R Dec 13 '10 at 21:52