void JS_ReportError(JSContext *cx, const char *format, ...); bool JS_ReportWarning(JSContext *cx, const char *format, ...);
||Pointer to a JS context from which to derive runtime information. Requires request. In a
||Format string to convert into an error message using
||...||Error message variables to insert into the format string.|
JS_ReportError is the simplest JSAPI function for reporting errors. First it builds an error message from the given
format string and any additional arguments passed after it. The resulting error message is passed to the context's
JSErrorReporter callback, if any.
If the caller is in a JSAPI callback,
Error object and sets it to be the pending exception on
cx. The callback must then return
JS_FALSE to cause the exception to be propagated to the calling script.
An example is shown in the JSAPI Phrasebook.