Subj : Re: SpiderMonkey: JavaScript exceptions and native code To : netscape.public.mozilla.jseng From : Braden McDaniel Date : Mon Aug 11 2003 02:24 am On Sun, 10 Aug 2003 22:11:32 -0700, Brendan Eich wrote: > Braden McDaniel wrote: > >>Can failure in any of the JS_* API functions result in a JavaScript >>exception being thrown? What, in general, is the proper way to deal with >>that in native code? Just return JS_TRUE ASAP? >> > > No, return JS_FALSE. A false return (or null, if the return value is of > pointer type and null is available without overloading that return > value) means error or exception. You can check whether an exception is > pending on a given context with JS_IsExceptionPending. > > The JS_Compile*, JS_Evaluate*, JS_ExecuteScript, and JS_CallFunction* > APIs will report uncaught exceptions if returning false or null to a > caller using a context with no stack frames active. So returning JS_FALSE from a native method implementation only terminates the script if no exception is pending? -- Braden McDaniel e-mail: Jabber: .