Subj : Re: Error handling To : Braden McDaniel From : Brendan Eich Date : Sat May 10 2003 02:21 am Braden McDaniel wrote: >I'm trying to get a feel for the Right way to handle errors in >implementing my own JavaScript classes and functions using SpiderMonkey. >Is throwing an exception generally preferred to calling JS_ReportError? If >not, when is each appropriate? > Errors other than "out of memory" become exceptions. If you need localizable error messages, you'll have to supply your own JSErrorCallback (see js.c for an example). If you want to signal conditions other than errors, you can throw objects or primitive values, however you please. /be .