在 Microsoft javascript 中,是否可以从 HRESULT 获取错误的文本描述?

发布于 2024-12-09 02:17:14 字数 779 浏览 5 评论 0原文

我知道 Error 对象 http://msdn.microsoft.com Microsoft javascript 中的 /en-us/library/dww52sbt

一些错误来自 HRESULT 并且它们具有有效的 number 属性(例如 -2147023570 映射到 0x8007052E,请参阅 Eric Lippert 的“Making Sense of HRESULTS”<一个href="http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx" rel="nofollow">http://blogs.msdn.com/b/ericlippert/archive /2003/10/22/53267.aspx )但是 message 属性(或 description 属性)为空(在我的示例中,文本为“登录失败:未知的用户名或错误密码。”)

我可以将 FormatMessage 调用(或 _com_error::ErrorMessage)包装在一个 COM 对象,然后从我的脚本中调用它(这是一个从命令行使用 cscript 启动的脚本),但我想知道是否可以在没有外部组件的情况下获取文本描述,但是仅依靠“标准”Windows 安装。

I know the Error object http://msdn.microsoft.com/en-us/library/dww52sbt in Microsoft javascript.

Some errors come from an HRESULT and they have a valid number property (for example -2147023570 which maps to 0x8007052E, see for example "Making Sense of HRESULTS" by Eric Lippert http://blogs.msdn.com/b/ericlippert/archive/2003/10/22/53267.aspx ) but the message property (or description property) is empty (in my example the text is "Logon failure: unknown user name or bad password.")

I can wrap a FormatMessage call (or _com_error::ErrorMessage) in a COM object and then call it from my script (it is a script launched with cscript from the command line) but I would like to know whether it is possible to get the textual description without an external component but just relying on a "standard" Windows installation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文