nsIXPCException

These exception objects are the preferred types of exceptions when implementing xpcom interfaces in JavaScript.
Inherits from: nsIException Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)

Method overview

void initialize(in string aMessage, in nsresult aResult, in string aName, in nsIStackFrame aLocation, in nsISupports aData, in nsIException aInner);
xpcexJSVal stealJSVal(); Native code only!
void stowJSVal(in xpcexJSContextPtr cx, in xpcexJSVal val); Native code only!

Methods

initialize()

void initialize(
  in string aMessage,
  in nsresult aResult,
  in string aName,
  in nsIStackFrame aLocation,
  in nsISupports aData,
  in nsIException aInner
);
Parameters
aMessage
aResult
aName
aLocation
aData
aInner

Native code only!

stealJSVal

xpcexJSVal stealJSVal();
Parameters

None.

Return value

Native code only!

stowJSVal

void stowJSVal(
  in xpcexJSContextPtr cx,
  in xpcexJSVal val
);
Parameters
cx
val

Remarks

Components.Exception is a JavaScript constructor to create nsIXPCException objects. The call signature of the constructor is:

Components.Exception(message, result, stack, data, inner)

all parameters are optional and the appropriate placeholder is 'unknown'.

  • message - A custom message set by the thrower (defaults to 'exception')
  • result - The nsresult associated with this exception (defaults to Components.results.NS_ERROR_FAILURE)
  • stack - The stack chain (defaults to the current stack)
  • data - additional data object of your choice (defaults to null)
  • inner - An inner exception that triggered this, if available