www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7460] New: std.windows.registry reports a false exception message

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: kekeniro2 yahoo.co.jp



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: -------
Feb 08 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7460




In D1, the msg property is in a different format so it does not contains the
error code. However, some operations still contain wrong messages.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 08 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7460




https://github.com/D-Programming-Language/phobos/pull/425

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 08 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7460




Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/1b871d944c1f32d494a73e9ba2969543971f7307


Issue 7460 - std.windows.registry reports a false exception message

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7460


kekeniro2 yahoo.co.jp changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
            Version|D1 & D2                     |D2
         Resolution|                            |FIXED



I confirmed it is fixed at D2.059head.
So I turn the target version into D2 and close the issue.

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