Throwable catching
Alexandr Druzhinin
drug2004 at bk.ru
Sat Sep 28 05:26:36 PDT 2013
28.09.2013 15:50, Jonathan M Davis пишет:
>
> It's just as wrong to catch Throwable there is at is anywhere. If you do that
> you'll catch Errors, and Errors are _supposed_ to kill your program. They
> indicate that something bad enough has occurred that it's better to terminate
> your program than continue.
>
> So, yes, what you're doing will keep the thread from dying, but if you get an
> Error, you want to shut your program down, not try and keep it running. So,
> maybe catching Throwable would make sense if you had to then tell the other
> thread to terminate, but should rethrow the Throwable afterwards and let the
> thread die.
>
> - Jonathan M Davis
>
Just to clear - in my case child thread processes parent commands like a
worker and every loop iteration isn't correlated with others before and
after so I thought that just new iteration resets bad application state
caused by Error - I was wrong?
More information about the Digitalmars-d-learn
mailing list