views:

141

answers:

2

Im learning Windows Workflow at the minute and am now looking 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.

A: 

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

Henrik Jepsen
+1  A: 

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.

ChrisF
thanks very much :)
johnboy