Bug 7460 – std.windows.registry reports a false exception message

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2012-02-08T00:43:00Z
Last change time
2012-02-20T07:57:33Z
Assigned to
nobody
Creator
kekeniro2

Comments

Comment #0 by kekeniro2 — 2012-02-08T00:43:09Z
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 by kekeniro2 — 2012-02-08T02:10:09Z
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 #2 by kekeniro2 — 2012-02-08T22:56:49Z
Comment #3 by github-bugzilla — 2012-02-18T10:53:02Z
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 by kekeniro2 — 2012-02-20T07:57:33Z
I confirmed it is fixed at D2.059head. So I turn the target version into D2 and close the issue.