开发者

Which exceptions to catch in a FaultHandler activity in Windows Workflow

Im learning Windows Workflow at the minute and am now lookin开发者_开发知识库g at exception handling in state machines. Basically I can see that a FaultHandler can be used to catch a specific exception thrown in an activity. My question is do I need to specifically catch each type of exception or is there a way I can catch all exceptions with one FaultHandler? Im sure this isn't best practice(any suggestions there?), but just interested to understand it a bit better.


You should explicitly catch the exceptions you think might occur.

You could have a general purpose exception that handled the base Exception class, but that would potentially hide problems with your code. You would need to log all exceptions and have some way of both letting the user know that there had been a problem and getting this information back to you so that you can correct the problem.


You can catch all if you set the FaultType to System.Exception.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜