Re: Windows Communication Foundation I think service invocations should be treated as low level invocations and exceptions should be a high level mechanism.
A SOAP fault should be a transport error when using SOAP. When using REST, HTTP status codes and messages should be used.
When using SOAP faults you can get a FaultException or a SoapException depending whether you are using WCF or ASMX. Should you build your service consumers be aware of the API over the transport either?
And you can also be accessing a database or a file (on a local drive or via FTP).
You should shield all this from the business invocation code and throw transport or communication exceptions.
As for business rules, a business exception should be thrown.
With this pattern, everyone will be happy:
1. No FaultExceptions or SoapException
2. Exceptions thrown when an error occurs. |