Why the hell do exceptions give error in the library rather than the user code?

Neia Neutuladh neia at ikeran.org
Fri Sep 14 16:53:10 UTC 2018


On Friday, 14 September 2018 at 16:43:04 UTC, Josphe Brigmo wrote:
> It is because you are throwing inside your code. When the throw 
> is from the library, it gives something like this:

std.exception.ErrnoException at std/stdio.d(430): Cannot open file 
`/doesntexist' in mode `w' (Permission denied)
----------------
/usr/include/dmd/phobos/std/exception.d:515 @safe void 
std.exception.bailOut!(std.exception.ErrnoException).bailOut(immutable(char)[], ulong, scope const(char)[]) [0x37130b11]
??:? @safe shared(core.stdc.stdio._IO_FILE)* 
std.exception.enforce!(std.exception.ErrnoException).enforce!(shared(core.stdc.stdio._IO_FILE)*).enforce(shared(core.stdc.stdio._IO_FILE)*, lazy const(char)[], immutable(char)[], ulong) [0x3713ed76]
??:? ref @safe std.stdio.File 
std.stdio.File.__ctor(immutable(char)[], scope const(char)[]) 
[0x371345cc]
scratch.d:7 void scratch.doThrow() [0x371307db]
scratch.d:14 _Dmain [0x37130838]

You're on Windows, by the look of it. Windows ships debug symbols 
in separate files. Do you have the debug symbols (*.pdb files) 
somewhere accessible? Did you at least compile your own code with 
-g to generate debug symbols for it?


More information about the Digitalmars-d mailing list