[Issue 13541] std.windows.syserror.sysErrorString() should be nothrow

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Sep 29 02:48:14 PDT 2014


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

--- Comment #8 from Walter Bright <bugzilla at digitalmars.com> ---
Point taken about sysErrorString() and GetLastError() not being infinite
recursion.

But still, FileException should be fixed so it does not throw in the
constructor, i.e. rewrite:

    if(length == 0)
    {
        throw new Exception(
            "failed getting error string for WinAPI error code: " ~
            sysErrorString(GetLastError()));
    }

as:

    if(length == 0)
    {
        auto newErrCode = GetLastError();
        assert(errCode != newErrCode);    // no infinite recursion
        return
            "failed getting error string for WinAPI error code: " ~
            sysErrorString(newErrCode);
    }

or something like that.

--


More information about the Digitalmars-d-bugs mailing list