On Wednesday, March 6, 2024 6:06:34 AM MST kdevel via Digitalmars-d-learn wrote: > On Saturday, 10 September 2022 at 08:48:39 UTC, Andrej Mitrovic > > wrote: > > [...] > > I wish the compiler would rewrite scope(failure) to use chained > > exceptions. Otherwise any exceptions thrown within > > scope(failure) can end up losing information about what was the > > original exception that was thrown. > > Ran into this issue with the following ordering bug: > > auto tmpfilename = fn.dup ~ ".XXXXXX\0"; > int fd = mkstemp (tmpfilename.ptr); > scope (failure) remove (tmpfilename); // bug: > if (fd == -1) > throw new Exception (strerror(errno).to!string); > > The error thrown was > > Failed to remove file ... > > Is there any work in progress to chain the exceptions in > scope(failure)?
If anything, I think that it's been decided that chained exceptions were a mistake. So, if things go in any direction with them, it's likely to be towards removing them, not doing more to support them. - Jonathan M Davis