Thread overview
[Issue 13542] std.file.FileException has GetLastError() as a default argument
Sep 28, 2014
Vladimir Panteleev
Sep 29, 2014
Walter Bright
Sep 29, 2014
Vladimir Panteleev
Oct 04, 2014
Walter Bright
Oct 04, 2014
Vladimir Panteleev
Oct 19, 2014
Vladimir Panteleev
Dec 17, 2022
Iain Buclaw
September 28, 2014
https://issues.dlang.org/show_bug.cgi?id=13542

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow@gmail.com

--- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> ---
Per my comment in https://issues.dlang.org/show_bug.cgi?id=13541#c2 , we should look into replacing uses of FileException / GetLastError with wenforce.

--
September 29, 2014
https://issues.dlang.org/show_bug.cgi?id=13542

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to Vladimir Panteleev from comment #1)
> Per my comment in https://issues.dlang.org/show_bug.cgi?id=13541#c2 , we should look into replacing uses of FileException / GetLastError with wenforce.

wenforce is currently private and throws an Exception, which would break code that looks for FileException.

While reengineering the interface has its place, this bug report is only about fixing the existing code and the way it works.

--
September 29, 2014
https://issues.dlang.org/show_bug.cgi?id=13542

--- Comment #3 from Vladimir Panteleev <thecybershadow@gmail.com> ---
(In reply to Walter Bright from comment #2)
> wenforce is currently private

No.

> and throws an Exception,

No. It throws a WindowsException.

> 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?

--
October 04, 2014
https://issues.dlang.org/show_bug.cgi?id=13542

--- Comment #4 from Walter Bright <bugzilla@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.

--
October 04, 2014
https://issues.dlang.org/show_bug.cgi?id=13542

--- Comment #5 from Vladimir Panteleev <thecybershadow@gmail.com> ---
(In reply to Walter Bright from comment #4)
> (In reply to Vladimir Panteleev from comment #3)
> > No. It throws a WindowsException.
> 
> Then it has changed recently? stdio.d line 961:

Oh, that's a completely different wenforce (which I also added a while ago, and forgot about). It should be changed to use the new one, in std.windows.syserror.

> > 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.

My suggestion was to make FileException an alias of OSException, so no code will break (unless it compares the class name string from classinfo or something).

--
October 19, 2014
https://issues.dlang.org/show_bug.cgi?id=13542

--- Comment #6 from Vladimir Panteleev <thecybershadow@gmail.com> ---
(In reply to Vladimir Panteleev from comment #5)
> My suggestion was to make FileException an alias of OSException, so no code will break (unless it compares the class name string from classinfo or something).

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

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=13542

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

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

--- Comment #7 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/10087

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--