nsIErrorService

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.

Document Tags and Contributors

 Contributors to this page: Sheppy, balah, Neil, trevorh
 Last updated by: Sheppy,