scope exception do not rise

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 6 07:06:56 PST 2014


On 11/05/2014 11:02 PM, Suliman wrote:
>> Replace that with something like writeln("caught") and you will see
>> that it is indeed caught. :) Printing the exception mimicks the
>> default behavior and you (and I) think that the exception is not
>> caught. :)
>
> that's work, but I can not understand where I can to look at exception
> level. If I right understand every function have own exceptions. For
> example std.file.
> Where I could look at what "e" will get? I mean "catch(Exception e)".
>

We have to look at the documentation of the function. In this case the 
possibilities are FileException and UTFException.

   http://dlang.org/phobos/std_file.html#.readText

However, judging by their names, they are both descendants of Exception, 
so what you are doing will catch either of them.

Ali



More information about the Digitalmars-d-learn mailing list