Clear NAPI error after native function invocations

This commit is contained in:
Kai Tamkun
2024-11-05 15:21:09 -08:00
parent 3296a6edc9
commit d4b710287f

View File

@@ -1833,6 +1833,7 @@ JSC_HOST_CALL_ATTRIBUTES JSC::EncodedJSValue NapiClass_ConstructorFunction(JSC::
Bun::NapiHandleScope handleScope(jsCast<Zig::GlobalObject*>(globalObject));
JSValue ret = toJS(napi->constructor()(napi->env(), frame.toNapi()));
napi_set_last_error(napi->env(), napi_ok);
RETURN_IF_EXCEPTION(scope, {});
if (ret.isEmpty()) {
ret = jsUndefined();