Why I can't catch the exception?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 5 11:15:47 PDT 2016


On Sunday, 5 June 2016 at 18:02:12 UTC, Suliman wrote:
> I really can't understand why try-catch block do not handle 
> exception.
> digit 1 is printing, so exception is accrue after it, but why 
> nothing in catch block?
>
> http://img.ctrlv.in/img/16/06/05/57546861d8e81.png

>     catch(Exception e)


You are catching Exception, but it is throwing Error. They are 
two separate things.

You shouldn't typically catch Error, instead try to fix the bug 
it indicates. But you can if you want by catch(Error e)


More information about the Digitalmars-d-learn mailing list