nsIErrorService

IID:e72f94b2-5f85-11d4-9877-00c04fa0cf4a
Inherits From:nsISupports

nsIErrorService: This is an interim 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.

This service will eventually get replaced by extending xpidl to allow errors to be defined. (http://bugzilla.mozilla.org/show_bug.cgi?id=13423).

This interface is intended to be used as a service. To create an object implementing this interface:

var obj = Components.classes["@mozilla.org/xpcom/error-service;1"].
            getService(Components.interfaces.nsIErrorService);

This interface is implemented by the following components:


Methods

char* getErrorStringBundle ( PRInt16 errorModule ) char* getErrorStringBundleKey ( nsresult error ) void registerErrorStringBundle ( PRInt16 errorModule , char* stringBundleURL ) void registerErrorStringBundleKey ( nsresult error , char* stringBundleKey ) void unregisterErrorStringBundle ( PRInt16 errorModule ) void unregisterErrorStringBundleKey ( nsresult error )

char* getErrorStringBundle ( PRInt16 errorModule )

Retrieves a string bundle URL for an error module.

Arguments:
errorModule

char* getErrorStringBundleKey ( nsresult error )

Retrieves a key in a string bundle for an nsresult error code. If no key is registered for the specified nsresult's code (obtained with NS_ERROR_GET_CODE), then the stringified version of the nsresult code is returned.

Arguments:
error

void registerErrorStringBundle ( PRInt16 errorModule , char* stringBundleURL )

Registers a string bundle URL for an error module. Error modules are obtained from nsresult code with NS_ERROR_GET_MODULE.

Arguments:
errorModule
stringBundleURL

void registerErrorStringBundleKey ( nsresult error , char* stringBundleKey )

Registers a key in a string bundle for an nsresult error code. Only the code portion of the nsresult is used (obtained with NS_ERROR_GET_CODE) in this registration. The string bundle key is used to look up internationalized messages in the string bundle.

Arguments:
error
stringBundleKey

void unregisterErrorStringBundle ( PRInt16 errorModule )

Registers a string bundle URL for an error module.

Arguments:
errorModule

void unregisterErrorStringBundleKey ( nsresult error )

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

Arguments:
error

Reference documentation is generated from Mozilla's source.

Add a note User Contributed Notes
No comments available

Copyright © 1999 - 2005 XULPlanet.com