nsIErrorService 编辑
xpcom/base/nsIErrorService.idl
Scriptable 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.7Implemented 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 withNS_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 asNS_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 asNS_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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论