Subj : Re: How do I raise an exception? To : netscape.public.mozilla.jseng From : Thomas Sondergaard Date : Wed Aug 03 2005 12:40 pm Brendan Eich wrote: > No, you can use JS_ReportError to throw errors as exceptions, but they > won't be localizable. The bug you may be referring to involves the > hardwired error numbers enumerated with other data by js.msg, and how an > embedding can't use JS_ReportErrorNumber or related APIs with its own > catalog of messages. I don't get an exception. I've traced through the code with gdb and I can see the js_ErrorToException returns JS_FALSE because errorNumber = JSMSG_NOT_AN_ERROR and then exn = JSEXN_NONE. What am I doing wrong? === From jsexn.c line 909 (js-1.5-rc6a.tar.gz): errorNumber = (JSErrNum) reportp->errorNumber; exn = errorToExceptionNum[errorNumber]; JS_ASSERT(exn < JSEXN_LIMIT); #if defined( DEBUG_mccabe ) && defined ( PRINTNAMES ) /* Print the error name and the associated exception name to stderr */ fprintf(stderr, "%s\t%s\n", errortoexnname[errorNumber].name, errortoexnname[errorNumber].exception); #endif /* * Return false (no exception raised) if no exception is associated * with the given error number. */ if (exn == JSEXN_NONE) return JS_FALSE; .