|
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/. */ |
|
5 |
|
6 /* |
|
7 * Interfaces for representing cross-language exceptions and stack traces. |
|
8 */ |
|
9 |
|
10 |
|
11 #include "nsISupports.idl" |
|
12 |
|
13 [scriptable, uuid(3bc4793f-e6be-44d6-b839-d6b9e85e5346)] |
|
14 interface nsIStackFrame : nsISupports |
|
15 { |
|
16 // see nsIProgrammingLanguage for list of language consts |
|
17 readonly attribute uint32_t language; |
|
18 readonly attribute AUTF8String languageName; |
|
19 readonly attribute AString filename; |
|
20 readonly attribute AString name; |
|
21 // Valid line numbers begin at '1'. '0' indicates unknown. |
|
22 readonly attribute int32_t lineNumber; |
|
23 readonly attribute AUTF8String sourceLine; |
|
24 readonly attribute nsIStackFrame caller; |
|
25 |
|
26 AUTF8String toString(); |
|
27 }; |
|
28 |
|
29 [scriptable, uuid(1caf1461-be1d-4b79-a552-5292b6bf3c35)] |
|
30 interface nsIException : nsISupports |
|
31 { |
|
32 // A custom message set by the thrower. |
|
33 [binaryname(MessageMoz)] readonly attribute AUTF8String message; |
|
34 // The nsresult associated with this exception. |
|
35 readonly attribute nsresult result; |
|
36 // The name of the error code (ie, a string repr of |result|) |
|
37 readonly attribute AUTF8String name; |
|
38 |
|
39 // Filename location. This is the location that caused the |
|
40 // error, which may or may not be a source file location. |
|
41 // For example, standard language errors would generally have |
|
42 // the same location as their top stack entry. File |
|
43 // parsers may put the location of the file they were parsing, |
|
44 // etc. |
|
45 |
|
46 // null indicates "no data" |
|
47 readonly attribute AString filename; |
|
48 // Valid line numbers begin at '1'. '0' indicates unknown. |
|
49 readonly attribute uint32_t lineNumber; |
|
50 // Valid column numbers begin at 0. |
|
51 // We don't have an unambiguous indicator for unknown. |
|
52 readonly attribute uint32_t columnNumber; |
|
53 |
|
54 // A stack trace, if available. |
|
55 readonly attribute nsIStackFrame location; |
|
56 // An inner exception that triggered this, if available. |
|
57 readonly attribute nsIException inner; |
|
58 |
|
59 // Arbitary data for the implementation. |
|
60 readonly attribute nsISupports data; |
|
61 |
|
62 // A generic formatter - make it suitable to print, etc. |
|
63 AUTF8String toString(); |
|
64 }; |