Subj : unsubscribe To : "'mozilla-jseng@mozilla.org'" From : reznik@ORsoftware.com (Alex Reznik) Date : Mon Aug 11 2003 03:06 pm -----Original Message----- From: Brendan Eich [mailto:brendan@meer.net] Sent: Monday, August 11, 2003 1:12 AM To: mozilla-jseng@mozilla.org; Braden McDaniel Subject: Re: SpiderMonkey: JavaScript exceptions and native code 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. /be .