What should you do?

You create Web-based client applications. You are creating a Web component that calls an existing function. The function might throw an application-specific exception of type InvalidChecksumException. The type InvalidChecksumException inherits from the System.ApplicationException class. The component is coded to recover from an InvalidChecksumException exception, but not to recover from other types of exceptions. The component does not have any additional information that could be usefully added to other types of errors or exceptions. You need to design the component to correctly handle exceptions. You also need to ensure that the exception handling strategy does not affect the performance of the component. What should you do?

You create Web-based client applications. You are creating a Web component that calls an existing function. The function might throw an application-specific exception of type InvalidChecksumException. The type InvalidChecksumException inherits from the System.ApplicationException class. The component is coded to recover from an InvalidChecksumException exception, but not to recover from other types of exceptions. The component does not have any additional information that could be usefully added to other types of errors or exceptions. You need to design the component to correctly handle exceptions. You also need to ensure that the exception handling strategy does not affect the performance of the component. What should you do?

A.
Use a catch statement that verifies an ApplicationException instance and find the exception type. If it is an InvalidChecksumException instance, handle it internally. Otherwise, pass the exception up the call stack.

B.
Use only a catch statement that verifies an InvalidChecksumException instance that will be handled internally.

C.
Use a catch statement without parameter. Verify the Message property to see if the exception is an InvalidChecksumException instance and handle it internally. Otherwise, pass the exception up the call stack.

D.
Use a catch statement that verifies an InvalidChecksumException instance followed by another catch statement that verifies general exceptions. In the first catch block, handle the exception internally. In the second catch block, log the error and pass the exception up the call stack as an inner exception.



Leave a Reply 0

Your email address will not be published. Required fields are marked *