Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* |
michael@0 | 7 | * Interfaces for representing cross-language exceptions and stack traces. |
michael@0 | 8 | */ |
michael@0 | 9 | |
michael@0 | 10 | |
michael@0 | 11 | #include "nsISupports.idl" |
michael@0 | 12 | |
michael@0 | 13 | [scriptable, uuid(3bc4793f-e6be-44d6-b839-d6b9e85e5346)] |
michael@0 | 14 | interface nsIStackFrame : nsISupports |
michael@0 | 15 | { |
michael@0 | 16 | // see nsIProgrammingLanguage for list of language consts |
michael@0 | 17 | readonly attribute uint32_t language; |
michael@0 | 18 | readonly attribute AUTF8String languageName; |
michael@0 | 19 | readonly attribute AString filename; |
michael@0 | 20 | readonly attribute AString name; |
michael@0 | 21 | // Valid line numbers begin at '1'. '0' indicates unknown. |
michael@0 | 22 | readonly attribute int32_t lineNumber; |
michael@0 | 23 | readonly attribute AUTF8String sourceLine; |
michael@0 | 24 | readonly attribute nsIStackFrame caller; |
michael@0 | 25 | |
michael@0 | 26 | AUTF8String toString(); |
michael@0 | 27 | }; |
michael@0 | 28 | |
michael@0 | 29 | [scriptable, uuid(1caf1461-be1d-4b79-a552-5292b6bf3c35)] |
michael@0 | 30 | interface nsIException : nsISupports |
michael@0 | 31 | { |
michael@0 | 32 | // A custom message set by the thrower. |
michael@0 | 33 | [binaryname(MessageMoz)] readonly attribute AUTF8String message; |
michael@0 | 34 | // The nsresult associated with this exception. |
michael@0 | 35 | readonly attribute nsresult result; |
michael@0 | 36 | // The name of the error code (ie, a string repr of |result|) |
michael@0 | 37 | readonly attribute AUTF8String name; |
michael@0 | 38 | |
michael@0 | 39 | // Filename location. This is the location that caused the |
michael@0 | 40 | // error, which may or may not be a source file location. |
michael@0 | 41 | // For example, standard language errors would generally have |
michael@0 | 42 | // the same location as their top stack entry. File |
michael@0 | 43 | // parsers may put the location of the file they were parsing, |
michael@0 | 44 | // etc. |
michael@0 | 45 | |
michael@0 | 46 | // null indicates "no data" |
michael@0 | 47 | readonly attribute AString filename; |
michael@0 | 48 | // Valid line numbers begin at '1'. '0' indicates unknown. |
michael@0 | 49 | readonly attribute uint32_t lineNumber; |
michael@0 | 50 | // Valid column numbers begin at 0. |
michael@0 | 51 | // We don't have an unambiguous indicator for unknown. |
michael@0 | 52 | readonly attribute uint32_t columnNumber; |
michael@0 | 53 | |
michael@0 | 54 | // A stack trace, if available. |
michael@0 | 55 | readonly attribute nsIStackFrame location; |
michael@0 | 56 | // An inner exception that triggered this, if available. |
michael@0 | 57 | readonly attribute nsIException inner; |
michael@0 | 58 | |
michael@0 | 59 | // Arbitary data for the implementation. |
michael@0 | 60 | readonly attribute nsISupports data; |
michael@0 | 61 | |
michael@0 | 62 | // A generic formatter - make it suitable to print, etc. |
michael@0 | 63 | AUTF8String toString(); |
michael@0 | 64 | }; |