nsIErrorService 编辑

xpcom/base/nsIErrorService.idlScriptable This is a service that allows nsresult codes to be mapped to string bundles that can be used to look up error messages. String bundle keys can also be mapped. Inherits from: nsISupports Last changed in Gecko 1.7

Implemented by: @mozilla.org/xpcom/error-service;1

Method overview

string getErrorStringBundle(in short errorModule);
string getErrorStringBundleKey(in nsresult error);
void registerErrorStringBundle(in short errorModule, in string stringBundleURL);
void registerErrorStringBundleKey(in nsresult error, in string stringBundleKey);
void unregisterErrorStringBundle(in short errorModule);
void unregisterErrorStringBundleKey(in nsresult error);

Methods

getErrorStringBundle()

Retrieves a string bundle URL for an error module.

string getErrorStringBundle(
  in short errorModule
);
Parameters
errorModule
The module for which the string bundle is registered. Error modules are obtained from nsresult code with NS_ERROR_GET_MODULE.
Return value

The URL of the string bundle registered for that module.

getErrorStringBundleKey()

Retrieves a key in a string bundle for an nsresult error code. If no key is registered for the specified nsresult, then the caller should use the nsresult's code (obtained with NS_ERROR_GET_CODE) instead.

string getErrorStringBundleKey(
  in nsresult error
);
Parameters
error
The nsresult for which the string bundle key is to be retrieved.
Return value

The key to use to retrieve the error string from the nsresult's module's string bundle.

registerErrorStringBundle()

Registers a string bundle URL for an error module.

void registerErrorStringBundle(
  in short errorModule,
  in string stringBundleURL
);
Parameters
errorModule
The module for which the string bundle is to be registered. Should be one of the modules listed in xpcom/base/nsError.h, such as NS_ERROR_MODULE_STORAGE.
stringBundleURL
The URL of the string bundle to register for the module.

registerErrorStringBundleKey()

Registers a key in a string bundle for an nsresult error code.

void registerErrorStringBundleKey(
  in nsresult error,
  in string stringBundleKey
);
Parameters
error
The nsresult for which the string bundle key is to be registered.
stringBundleKey
The key that should be used to retrieve the error string from string bundle for the given nsresult.

unregisterErrorStringBundle()

Unregisters a string bundle URL for an error module.

void unregisterErrorStringBundle(
  in short errorModule
);
Parameters
errorModule
The module for which the string bundle is to be unregistered. Should be one of the modules listed in xpcom/base/nsError.h, such as NS_ERROR_MODULE_STORAGE.

unregisterErrorStringBundleKey()

Unregisters a key in a string bundle for an nsresult error code.

void unregisterErrorStringBundleKey(
  in nsresult error
);
Parameters
error
The nsresult for which the string bundle key is to be unregistered.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:78 次

字数:6282

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文