Is there a benefit to JUST a “throw” in a catch?

后端 未结 11 1265
醉梦人生
醉梦人生 2021-02-07 06:42

Been having a \"heated debate\" with a colleague about his practice of wrapping most of his functions in a try/catch but the catch has JUST a \"throw\" in it e.g.



        
11条回答
  •  悲&欢浪女
    2021-02-07 07:09

    Yes, it's handy for putting a breakpoint in the catch.

    An alternate and cleaner way is to breakpoint in the constructor of the object you're throwing. You're seeing the program state at a point closer to the source of the error.

提交回复
热议问题