Try/Catch and threading

前端 未结 5 944
谎友^
谎友^ 2021-02-07 13:29

I have an idea why but I\'d like to ask if someone has a good grasp on why the exception raised inside a thread is never caught by the code that started it. Here\'s some very si

5条回答
  •  一生所求
    2021-02-07 14:06

    It's a bad idea to make assumptions, especially where multiple threads are involved (you know that old saying).

    Why would the code that started the thread see the exception? The code that started the thread may not even exist when the exception is thrown.

提交回复
热议问题