michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * Interfaces for representing cross-language exceptions and stack traces. michael@0: */ michael@0: michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: [scriptable, uuid(3bc4793f-e6be-44d6-b839-d6b9e85e5346)] michael@0: interface nsIStackFrame : nsISupports michael@0: { michael@0: // see nsIProgrammingLanguage for list of language consts michael@0: readonly attribute uint32_t language; michael@0: readonly attribute AUTF8String languageName; michael@0: readonly attribute AString filename; michael@0: readonly attribute AString name; michael@0: // Valid line numbers begin at '1'. '0' indicates unknown. michael@0: readonly attribute int32_t lineNumber; michael@0: readonly attribute AUTF8String sourceLine; michael@0: readonly attribute nsIStackFrame caller; michael@0: michael@0: AUTF8String toString(); michael@0: }; michael@0: michael@0: [scriptable, uuid(1caf1461-be1d-4b79-a552-5292b6bf3c35)] michael@0: interface nsIException : nsISupports michael@0: { michael@0: // A custom message set by the thrower. michael@0: [binaryname(MessageMoz)] readonly attribute AUTF8String message; michael@0: // The nsresult associated with this exception. michael@0: readonly attribute nsresult result; michael@0: // The name of the error code (ie, a string repr of |result|) michael@0: readonly attribute AUTF8String name; michael@0: michael@0: // Filename location. This is the location that caused the michael@0: // error, which may or may not be a source file location. michael@0: // For example, standard language errors would generally have michael@0: // the same location as their top stack entry. File michael@0: // parsers may put the location of the file they were parsing, michael@0: // etc. michael@0: michael@0: // null indicates "no data" michael@0: readonly attribute AString filename; michael@0: // Valid line numbers begin at '1'. '0' indicates unknown. michael@0: readonly attribute uint32_t lineNumber; michael@0: // Valid column numbers begin at 0. michael@0: // We don't have an unambiguous indicator for unknown. michael@0: readonly attribute uint32_t columnNumber; michael@0: michael@0: // A stack trace, if available. michael@0: readonly attribute nsIStackFrame location; michael@0: // An inner exception that triggered this, if available. michael@0: readonly attribute nsIException inner; michael@0: michael@0: // Arbitary data for the implementation. michael@0: readonly attribute nsISupports data; michael@0: michael@0: // A generic formatter - make it suitable to print, etc. michael@0: AUTF8String toString(); michael@0: };