VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/base/nsIExceptionService.idl@ 58038

Last change on this file since 58038 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * ActiveState Tool Corp..
19 * Portions created by the Initial Developer are Copyright (C) 2001
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 * Mark Hammond <[email protected]>
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39#include "nsISupports.idl"
40#include "nsIException.idl"
41
42// An exception provider. These can turn special nsresult codes
43// into nsIExceptions
44
45[scriptable, uuid(0577744c-c1d2-47f2-8bcc-ce7a9e5a88fc)]
46interface nsIExceptionProvider : nsISupports
47{
48 /** Gets an nsIException or returns NULL if not possible. **/
49 nsIException getException(in nsresult result, in nsIException defaultException);
50};
51
52// A ScriptErrorManager for a single thread. These objects
53// are _not_ thread-safe. Use the ScriptErrorService
54// to get a script error manager for your current thread.
55[scriptable, uuid(efc9d00b-231c-4feb-852c-ac017266a415)]
56interface nsIExceptionManager : nsISupports
57{
58 /** Sets (or clears with nsnull) the current error on the this thread. */
59 void setCurrentException( in nsIException error);
60
61 /** Gets the current error for the current thread, or NULL if no error */
62 nsIException getCurrentException();
63
64 /** Gets an exception from a registered exception provider..
65 This has no effect on the "current exception" */
66 nsIException getExceptionFromProvider( in nsresult rc, in nsIException defaultException);
67};
68
69
70// The Exception Service. Allows you to get an set exceptions in a thread
71// safe manner, or to get an ExceptionManager for your specific thread.
72[scriptable, uuid(35A88F54-F267-4414-92A7-191F6454AB52)]
73interface nsIExceptionService : nsIExceptionManager
74{
75 /** Obtains an exception manager for the current thread. */
76 readonly attribute nsIExceptionManager currentExceptionManager;
77
78 /** Installs an "exception provider" which is capable of
79 translating an nsresult into an exception. This enables
80 error providers to return simple nsresults and only provide
81 rich errors when specifically requested. It also has the
82 advantage of allowing code like the DOM to handle all errors
83 in a single function rather than at each XPCOM entry point.
84 NOTE: This interface must be thread-safe - it will be called
85 on whatever thread needs the error translation performed.*/
86 void registerExceptionProvider( in nsIExceptionProvider provider, in PRUint32 moduleCode );
87 void unregisterExceptionProvider( in nsIExceptionProvider provider, in PRUint32 moduleCode );
88};
89
90
91%{ C++
92#define NS_EXCEPTIONSERVICE_CLASSNAME "Exception Service"
93// {35A88F54-F267-4414-92A7-191F6454AB52}
94#define NS_EXCEPTIONSERVICE_CID \
95{ 0x35a88f54, 0xf267, 0x4414, { 0x92, 0xa7, 0x19, 0x1f, 0x64, 0x54, 0xab, 0x52 } }
96#define NS_EXCEPTIONSERVICE_CONTRACTID "@mozilla.org/exceptionservice;1"
97%}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette