D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7460 - std.windows.registry reports a false exception message
Summary: std.windows.registry reports a false exception message
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-08 00:43 UTC by kekeniro2
Modified: 2012-02-20 07:57 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description kekeniro2 2012-02-08 00:43:09 UTC
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
  }
}
Comment 1 kekeniro2 2012-02-08 02:10:09 UTC
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.
Comment 3 github-bugzilla 2012-02-18 10:53:02 UTC
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/1b871d944c1f32d494a73e9ba2969543971f7307
Merge pull request #425 from qchikara/myfeature

Issue 7460 - std.windows.registry reports a false exception message
Comment 4 kekeniro2 2012-02-20 07:57:33 UTC
I confirmed it is fixed at D2.059head.
So I turn the target version into D2 and close the issue.