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 } }
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.
https://github.com/D-Programming-Language/phobos/pull/425
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
I confirmed it is fixed at D2.059head. So I turn the target version into D2 and close the issue.