Is there a difference between “throw” and “throw ex”?

前端 未结 10 2364
夕颜
夕颜 2020-11-22 01:08

There are some posts that asks what the difference between those two are already.
(why do I have to even mention this...)

But my question is different in a way

10条回答
  •  抹茶落季
    2020-11-22 01:33

    No, this will cause the exception to have a different stack trace. Only using a throw without any exception object in the catch handler will leave the stack trace unchanged.

    You may want to return a boolean from HandleException whether the exception shall be rethrown or not.

提交回复
热议问题