Which exceptions shouldn't I catch?

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

    A more proper design would be supported by the question: Which exceptions should I catch?

    If you really need to catch any and all exceptions and still keep going, then you should be using both AppDomains and separate worker processes. Or change your host to ASP.NET or the task scheduler, which have already done all the hard work around process isolation and retries.

提交回复
热议问题