Which exceptions shouldn't I catch?

后端 未结 6 1381
耶瑟儿~
耶瑟儿~ 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:53

    I would refer to the advice from the following article.

    .NET Framework design guidelines rules: Do Not Catch Exceptions That You Cannot Handle

    http://www.codeproject.com/KB/cs/csmverrorhandling.aspx

    Also from the referenced article:

    You should never catch System.Exception or System.SystemException in a catch block

提交回复
热议问题