[Issue 7460] New: std.windows.registry reports a false exception message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 8 00:43:12 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7460

           Summary: std.windows.registry reports a false exception message
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: kekeniro2 at yahoo.co.jp


--- Comment #0 from kekeniro2 at yahoo.co.jp 2012-02-08 00:43:09 PST ---
When a registry operation failed, the generated exception's msg property
contains '(0)'(means Non Error) instead of its Win32 Error Code.


Such as:

import std.windows.registry;
import std.stdio, std.string;

void main()
{
  try {
    Registry.currentUser.getKey("TEST_NONEXISTKEY");
  } catch (RegistryException e) {
    std.stdio.writeln( "error=", e.error, ":", e.msg );

    assert( e.error == 2);                            // 2=ERROR_FILE_NOT_FOUND
    assert( std.string.indexOf(e.msg, "(0)") == -1 ); // 0=ERROR_SUCCESS
    assert( std.string.indexOf(e.msg, "(2)") != -1 ); // 2=ERROR_FILE_NOT_FOUND
  }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list