There are no specific exception handling guidelines for CS2009. Through CS foundation (operation sequence components), we are calling different the services which performs some action and returns few validation exceptions for invalid data or conditions. We thought of creating custom exception class for each type of validation message so that the client application can react accordingly. Below diagram shows the high level architecture of exception handling across layers.
The implementation went smooth but the real problem came when we try to test the code. We are getting fault exception from the service and can be able to catch it properly in operation sequence components but when the control goes from operation sequence components to app layer the exception is converted as Generic exception. Not sure, where is the problem is and why the exception is converted back to generic exception. After troubleshoot further and digging through CS2009 code with reflector, I found that commerce server broker is catching all exceptions and converting to generic exceptions (except fault exceptions). Check below image for more details.
I feel, Microsoft feels it may be security issue of sending back all (external or internal) exceptions back to calling program and that might be the reason for suppressing all exceptions except fault exception. I have to changed my application architecture and now I am bringing fault exceptions and handling them in controller or presenter level which is still satisfying my requirement.
If you like this post, please click on our sponsor advertisement.
