On 02/04/2016 10:41 PM, tcak wrote:
> On Friday, 5 February 2016 at 06:23:09 UTC, Daniel Kozak wrote:
>> V Fri, 05 Feb 2016 03:47:40 +0000
>> tcak via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com>
>> napsáno:
>>
>>> [...]
>>
>> Did you try catch Throwable instead of Exception?

I was about to write same thing. :)

> Undid the fix, and wrapped the problem causing function call with
> try-catch-Throwable, it is caught now.

However, it is not recommended to catch Throwable (nor Error).

> I always used Exception before, thinking that it was the base of all
> exceptions.

Exception is topmost exception that makes sense to catch because it represents recoverable situations. Error on the other hand is for irrecoverable errors representing situations that may be so buggy that even try-catch may not work properly.

     Throwable
      /     \
Exception   Error

Imagine that the out-of-bounds error was due to some memory corruption. If so, all bets are off... We don't know what state the program is in. If we catch Throwable (or Error) and continue operating, we may produce completely wrong results.

Of course, in this case I think you are just logging that the thread is exiting. (Even then, in theory, the attempt to log can format the cloud data center. :p)

Ali

Reply via email to