diff --git a/src/sbbs3/js_global.c b/src/sbbs3/js_global.c index 90d7b5a324792451a813a30982bca0140ebd5603..c30155c6b9d7f46d2ee645407fcbe221246a9c71 100644 --- a/src/sbbs3/js_global.c +++ b/src/sbbs3/js_global.c @@ -723,12 +723,13 @@ js_require(JSContext *cx, uintN argc, jsval *arglist) ret = js_load(cx, argc-1, arglist); - // TODO: this error is happening if the file doesn't exist! - if (!JS_HasProperty(cx, exec_obj, property, &found) || !found) { - JSVALUE_TO_MSTRING(cx, argv[fnarg], filename, NULL); - JS_ReportError(cx,"symbol '%s' not defined by script '%s'", property, filename); - free(filename); - return(JS_FALSE); + if (!JS_IsExceptionPending(cx)) { + if (!JS_HasProperty(cx, exec_obj, property, &found) || !found) { + JSVALUE_TO_MSTRING(cx, argv[fnarg], filename, NULL); + JS_ReportError(cx,"symbol '%s' not defined by script '%s'", property, filename); + free(filename); + return(JS_FALSE); + } } free(property); return ret;