[Issue 13542] std.file.FileException has GetLastError() as a default argument

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Oct 4 02:54:09 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13542

--- Comment #4 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to Vladimir Panteleev from comment #3)
> (In reply to Walter Bright from comment #2)
> > wenforce is currently private 
> 
> No.
> 
> > and throws an Exception, 
> 
> No. It throws a WindowsException.

Then it has changed recently? stdio.d line 961:

        private static T wenforce(T)(T cond, string str)
        {
            import std.windows.syserror;

            if (cond) return cond;
            throw new Exception(str ~ ": " ~ sysErrorString(GetLastError()));
        }

> 
> > which would break code that looks for FileException.
> 
> Per my comment in https://issues.dlang.org/show_bug.cgi?id=13541#c6 we
> should introduce OSException make FileException an alias of OS
> 
> > While reengineering the interface has its place, this bug report is only
> > about fixing the existing code and the way it works.
> 
> I suggest fixing the existing code without breaking it. Why do you think I
> suggested otherwise?

Because I thought you suggested throwing a different error than FileException.
IF that is incorrect, then I was wrong.

--


More information about the Digitalmars-d-bugs mailing list