cpp: always return empty JSValue value after throwing exception (#13935)

Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
This commit is contained in:
Meghan Denny
2024-09-23 13:53:08 -07:00
committed by GitHub
parent ff9560c82a
commit 33075394a4
53 changed files with 899 additions and 898 deletions

View File

@@ -40,7 +40,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionWrite, (JSC::JSGlobalObject * globalObject,
int32_t fd = STDOUT_FILENO;
if (callframe->argumentCount() > 1) {
fd = arg1.toInt32(globalObject);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
RETURN_IF_EXCEPTION(scope, {});
} else {
toWriteArg = arg1;
}
@@ -53,7 +53,7 @@ JSC_DEFINE_HOST_FUNCTION(jsFunctionWrite, (JSC::JSGlobalObject * globalObject,
}
auto string = toWriteArg.toWTFString(globalObject);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
RETURN_IF_EXCEPTION(scope, {});
auto utf8 = string.utf8();
auto length = utf8.length();
auto written = write(fd, utf8.data(), length);