1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
9 * nsIErrorService: This is an interim service that allows nsresult codes to be mapped to
10 * string bundles that can be used to look up error messages. String bundle keys can also
13 * This service will eventually get replaced by extending xpidl to allow errors to be defined.
14 * (http://bugzilla.mozilla.org/show_bug.cgi?id=13423).
16 [scriptable
, uuid(e72f94b2
-5f85
-11d4
-9877-00c04fa0cf4a
)]
17 interface nsIErrorService
: nsISupports
20 * Registers a string bundle URL for an error module. Error modules are obtained from
21 * nsresult code with NS_ERROR_GET_MODULE.
23 void registerErrorStringBundle
(in short errorModule
, in string stringBundleURL
);
26 * Unregisters a string bundle URL for an error module.
28 void unregisterErrorStringBundle
(in short errorModule
);
31 * Retrieves a string bundle URL for an error module.
33 string getErrorStringBundle
(in short errorModule
);
36 * Registers a key in a string bundle for an nsresult error code. Only the code portion
37 * of the nsresult is used (obtained with NS_ERROR_GET_CODE) in this registration. The
38 * string bundle key is used to look up internationalized messages in the string bundle.
40 void registerErrorStringBundleKey
(in nsresult error
, in string stringBundleKey
);
43 * Unregisters a key in a string bundle for an nsresult error code.
45 void unregisterErrorStringBundleKey
(in nsresult error
);
48 * Retrieves a key in a string bundle for an nsresult error code. If no key is registered
49 * for the specified nsresult's code (obtained with NS_ERROR_GET_CODE), then the stringified
50 * version of the nsresult code is returned.
52 string getErrorStringBundleKey
(in nsresult error
);
57 // The global nsIErrorService:
58 #define NS_ERRORSERVICE_NAME
"Error Service"
59 #define NS_ERRORSERVICE_CONTRACTID
"@mozilla.org/xpcom/error-service;1"
60 #define NS_ERRORSERVICE_CID \
61 { /* 744afd5e-5f8c-11d4-9877-00c04fa0cf4a */ \
65 {0x98, 0x77, 0x00, 0xc0, 0x4f, 0xa0, 0xcf, 0x4a} \