Which exceptions shouldn't I catch?

后端 未结 6 1369
耶瑟儿~
耶瑟儿~ 2020-12-02 21:31

I have an app that runs a long batch process where many exceptions could potentially be thrown. If a non-critical exception is thrown during one item in the batch, I want to

6条回答
  •  时光说笑
    2020-12-02 21:51

    Don't catch any exceptions you don't know how to handle safely.

    Catching Exception is a particularly bad practice, the only one worse is a catch that doesn't specify any managed exception type (as it would catch non-managed exceptions as well).

提交回复
热议问题