Managing exceptions on EDRA - quick tip

The exceptions thrown by business actions in EDRA are caught by the corresponding adapters (either a generic Exception or a BusinessRuleException). In the case of the WebServiceInterfaceAdapter, it will catch BusinessRuleException's and Exception's and will generate a SoapException and with the exception information in its details node.

This way the client will always see a SoapException (in the case of webservices) or an ApplicationException (in the case of remoting).

The idea is to get the SoapException on the client and make use of it.

This piece of code will clarify it.

try {
    // call EDRA service
catch ( SoapException se ) {
    if ( se.Code == SoapException.ClientFaultCode ) {
         // this is a BusinessRuleException. Show it to the client
         lblBizRuleBroken.Text = GetDetails( se.Detail );
    } else {
         // this is an Exception, a server fault, user normally don't want to see it
         // Show a generic message and the reference code. The reference code is in the Detail XmlNode of the se


Published: September 28 2004

blog comments powered by Disqus