Re: thread exceptions

2012-08-08 Thread Ali Çehreli
On 08/08/2012 12:44 PM, Martin Krejcirik wrote: > Easy, just catch Throwable :-) The problem is, Error (and Throwable) should not be caught. There is no guarantee of program behavior when an Error is thrown. At the least, an AssertError is by definition pointing at bad program state so no furt

Re: thread exceptions

2012-08-08 Thread Martin Krejcirik
On 8.8.2012 18:15, Ali Çehreli wrote: > } catch (shared(Exception) exc) { > owner.send(exc); Ahh shared, I've been trying immutable and such. Thanks a lot. > > Although, I've been bitten by the fact that AssertError is not an > Exception, so exceptions thrown

Re: thread exceptions

2012-08-08 Thread Ali Çehreli
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 {

Re: thread exceptions

2012-08-08 Thread Sean Kelly
Oh, I should mention that if you use core.thread explicitly, any unhandled exception will be re-thrown in the context of whoever joins that thread. On Aug 8, 2012, at 1:52 AM, Martin Krejcirik wrote: > Hi Ali, > > On 8.8.2012 5:36, Ali Çehreli wrote: >> The OwnerTerminated and LinkTerminated

Re: thread exceptions

2012-08-08 Thread Sean Kelly
I'll have to think about it. The current approach in std.concurrency is intended to be forwards-compatible with interprocess messaging, and serializing/deserializing an arbitrary exception would be tricky. See the exception thrown by receiveOnly as an example of how I addressed the issue there.

Re: thread exceptions

2012-08-08 Thread Martin Krejcirik
Hi Ali, On 8.8.2012 5:36, Ali Çehreli wrote: > The OwnerTerminated and LinkTerminated exceptions can be received as > messages as well. The following code demonstrates this for the > OwnerTerminated exception: I meant how can I print the actual exception from the thread, including it's error mess

Re: thread exceptions

2012-08-07 Thread Ali Çehreli
On 08/07/2012 06:25 PM, Martin Krejcirik wrote: > Hi, > > using std.concurrency, is it possible to print an exception if a thread > throws (and the main thread is still running) ? It just terminates and > prints nothing. I tried to catch it and send as a message to the main > thread, but haven't s

thread exceptions

2012-08-07 Thread Martin Krejcirik
Hi, using std.concurrency, is it possible to print an exception if a thread throws (and the main thread is still running) ? It just terminates and prints nothing. I tried to catch it and send as a message to the main thread, but haven't succeeded so far. -- mk