thread exceptions

Ali Çehreli acehreli at yahoo.com
Wed Aug 8 09:15:06 PDT 2012


On 08/08/2012 01:52 AM, Martin Krejcirik wrote:

 > I meant how can I print the actual exception from the thread, including
 > it's error message, stack trace etc.

Catching the exception explicitly and rethrowing would help a little:

// ... at the worker ...
                 try {
                     // ...

                 } catch (shared(Exception) exc) {
                     owner.send(exc);
                 }},

// ... at the owner ...
         receive(
             // ...

             (shared(Exception) exc) {
                 throw exc;
             });

Although, I've been bitten by the fact that AssertError is not an 
Exception, so exceptions thrown by assert checks will continue to 
surprise. :/

Ali



More information about the Digitalmars-d-learn mailing list