You work as the Enterprise application developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003. Your responsibilities at Domain.com include the design and development of applications. You are currently developing a business logic component that is used in a line-of-business (LOB) application. The business logic component calls a Web method named SeeCustomer in an Extensible Markup Language (XML) Web service. The SeeCustomer Web method throws an exception of a type SoapExtension in the event of the specified customer being non-existent. Now, when this exception is thrown, you must call a Web method named NewCustomer. To this end you need to implement the appropriate exception handling mechanism to meet this requirement.
What should you do?
A.
Do nothing and leave the exception.
B.
First catch the exception and do not re-throw it.
C.
First catch the exception, then log it, and then re-throw it.
D.
First catch the exception, then wrap the exception, and then throw the wrapped exception.
Explanation:
When an exception is caught, you prevent it from propagating up the call stack. This will then allow you to call the NewCustomer Web method. Thus you should catch the exception and not re-throw it.
Incorrect answers:
A: Not doing anything about the exception will allow the exception to propagate up the call stack and prevent you from calling the NewCustomer Web method.
C: Re-throwing the exception will result in the exception propagating up the call stack and will not afford you the opportunity to call the NewCustomer Web method.
D: A Wrapped exception being thrown would result in a new exception up the call stack and will also prevent you from calling the NewCustomer Web method.