February 26, 2007
How do I read the exceptions thrown in the main > scope(failure) ? Or should I just put everything in a try-catch ?


February 26, 2007
Saaa wrote:
> How do I read the exceptions thrown in the main > scope(failure) ?
> Or should I just put everything in a try-catch ?
> 
> 
You can't handle any exceptions outside of try-catch-finally blocks.  The scope guards exist to ensure that any cleanup necessary (such as closing network connections or releasing mutexes in multithreaded programs) gets performed before all references to the associated resources are lost.  To actually access the exceptions the exception needs to be thrown in the scope of a try block (somewhere, it doesn't need to be the immediate function) and that try block must have a catch and/or finally block.
February 26, 2007
Okay, thanks.


>> How do I read the exceptions thrown in the main > scope(failure) ? Or should I just put everything in a try-catch ?
>>
>>
> You can't handle any exceptions outside of try-catch-finally blocks.  The scope guards exist to ensure that any cleanup necessary (such as closing network connections or releasing mutexes in multithreaded programs) gets performed before all references to the associated resources are lost.  To actually access the exceptions the exception needs to be thrown in the scope of a try block (somewhere, it doesn't need to be the immediate function) and that try block must have a catch and/or finally block.


1 2 3
Next ›   Last »