views:

43

answers:

3

what does it mean when one says allow exception to propagate upwards to the client ??
How does it work?

+2  A: 

'Client' being what ever code is calling the method in question where the exception is encountered. You can handle it in the method, or if you don't handle it, the caller will get that exception. If it does not handle it, it keeps going up the stack of method calls until it reaches Main() and nothing has handled it (or some equivalent), causing the unhandled exception handler to step in.

"The Client" then would be whatever mechanism is in place to display a 'friendly' error to the user, whether that's a web page or winform, etc.

Andrew Barber
+1  A: 

An exception that is not caught will result in the premature end of the method executing at the time. If the enclosing method does not catch the exception then the same happens to it. This continues until execution is back to the Main method, at which point the application itself dies and reports the exception to Windows.

Andrew Cooper
+1  A: 

When an exception is thrown, the framework expects it to be dealt with. It will look at the current call in the call stack. If there is no appropriate catch, it will move up the call stack to the current call's caller. If there is no appropriate catch there, it will move up a level again. It will continue to do this. If it reaches the top-entry point into the program, then the entire program will crash, which the client will obviously see.

rchern