Subj : Re: How do I raise an exception? To : netscape.public.mozilla.jseng From : Thomas Sondergaard Date : Wed Aug 03 2005 12:14 pm Rob Swindell wrote: > I use JS_ReportError and it seems to work fine. Example: > > if((p=(private_t*)malloc(sizeof(private_t)))==NULL) { > JS_ReportError(cx,"malloc failed"); > return(JS_FALSE); > } > It doesn't work for me. The error reported with JS_ReportError is passed to the error reporter I have configured with JS_SetErrorReporter, but I don't get a catchable exception my script just exits. I tried printing the value returned by JS_IsExceptionPending after calling JS_ReportError, like this: JS_ReportError(ctx, "Invalid argument - not an int"); cerr << "after JS_ReportError: " << JS_IsExceptionPending(ctx) << endl; ... and it tells me that an exception is not pending. Under what conditions will JS_ReportError not raise an exception? Thanks for helping with all my rookie questions. regards, Thomas .