xpcom/base/nsIException.idl
author Mike Hommey <mh+mozilla@glandium.org>
Thu, 30 Oct 2014 13:05:56 +0900
changeset 237375 a7b5bb9e867a583d01513acb8ca4431cc9acb3d1
parent 229796 b0dd65a5d40b6b7031c8a773b03f410159ef3ecd
child 251214 a091ec8d2a048d520585cd41bb79d821ad316433
permissions -rw-r--r--
Bug 1077148 part 2 - Remove hack to avoid sqlite being linked against mozglue on mac. r=gps This hack has actually not been actively used since sqlite, nss and nspr are all folded together, because no shared library is actually linked in db/sqlite3/src.

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/*
 * Interfaces for representing cross-language exceptions and stack traces.
 */


#include "nsISupports.idl"

[scriptable, uuid(f80ac10b-68dd-4482-a8c2-3cbe13fa89af)]
interface nsIStackFrame : nsISupports
{
    // see nsIProgrammingLanguage for list of language consts
    readonly attribute uint32_t                language;
    readonly attribute AUTF8String             languageName;
    readonly attribute AString                 filename;
    readonly attribute AString                 name;
    // Valid line numbers begin at '1'. '0' indicates unknown.
    readonly attribute int32_t                 lineNumber;
    readonly attribute int32_t                 columnNumber;
    readonly attribute AUTF8String             sourceLine;
    readonly attribute nsIStackFrame           caller;

    // Returns a formatted stack string that looks like the sort of
    // string that would be returned by .stack on JS Error objects.
    // Only works on JS-language stack frames.
    readonly attribute AString                 formattedStack;

    AUTF8String toString();
};

[scriptable, uuid(1caf1461-be1d-4b79-a552-5292b6bf3c35)]
interface nsIException : nsISupports
{
    // A custom message set by the thrower.
    [binaryname(MessageMoz)] readonly attribute AUTF8String message;
    // The nsresult associated with this exception.
    readonly attribute nsresult                result;
    // The name of the error code (ie, a string repr of |result|)
    readonly attribute AUTF8String             name;

    // Filename location.  This is the location that caused the
    // error, which may or may not be a source file location.
    // For example, standard language errors would generally have
    // the same location as their top stack entry.  File
    // parsers may put the location of the file they were parsing,
    // etc.

    // null indicates "no data"
    readonly attribute AString                 filename;
    // Valid line numbers begin at '1'. '0' indicates unknown.
    readonly attribute uint32_t                lineNumber;
    // Valid column numbers begin at 0. 
    // We don't have an unambiguous indicator for unknown.
    readonly attribute uint32_t                columnNumber;

    // A stack trace, if available.
    readonly attribute nsIStackFrame           location;
    // An inner exception that triggered this, if available.
    readonly attribute nsIException            inner;

    // Arbitary data for the implementation.
    readonly attribute nsISupports             data;

    // A generic formatter - make it suitable to print, etc.
    AUTF8String toString();
};