Is there any way to start the Ruby debugger on exception?

前端 未结 5 1124
温柔的废话
温柔的废话 2020-12-28 09:21

Is there any way to start the/a Ruby debugger whenever the code throws an exception, without me wrapping the code like this:

begin
  #do something
rescue
  d         


        
5条回答
  •  囚心锁ツ
    2020-12-28 09:47

    if you're using ruby-debug (and it looks like you are), you can set catchPoints for the exception you want.

     (rdbg) catch Exception
    

    for example

提交回复
热议问题