aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/BunPlugin.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-09-05 23:43:34 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-09-05 23:43:34 -0700
commit5a715210218715f71cba2053083ba9993ea82c7e (patch)
treee4f8516aea667114038641db896bacacbe017c8e /src/bun.js/bindings/BunPlugin.cpp
parent11aa17a57cc679d34e8e6f6f7aa665f565cb7305 (diff)
downloadbun-5a715210218715f71cba2053083ba9993ea82c7e.tar.gz
bun-5a715210218715f71cba2053083ba9993ea82c7e.tar.zst
bun-5a715210218715f71cba2053083ba9993ea82c7e.zip
[Bun.plugin] Clean up exception handling
Diffstat (limited to 'src/bun.js/bindings/BunPlugin.cpp')
-rw-r--r--src/bun.js/bindings/BunPlugin.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/bun.js/bindings/BunPlugin.cpp b/src/bun.js/bindings/BunPlugin.cpp
index ba1d40a0b..f7fa33377 100644
--- a/src/bun.js/bindings/BunPlugin.cpp
+++ b/src/bun.js/bindings/BunPlugin.cpp
@@ -300,6 +300,7 @@ extern "C" EncodedJSValue jsFunctionBunPlugin(JSC::JSGlobalObject* globalObject,
JSFunction* function = jsCast<JSFunction*>(setupFunctionValue);
JSC::CallData callData = JSC::getCallData(function);
JSValue result = call(globalObject, function, callData, JSC::jsUndefined(), args);
+
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
if (auto* promise = JSC::jsDynamicCast<JSC::JSPromise*>(result)) {
@@ -375,9 +376,7 @@ EncodedJSValue BunPlugin::OnLoad::run(JSC::JSGlobalObject* globalObject, ZigStri
auto result = call(globalObject, function, callData, JSC::jsUndefined(), arguments);
if (UNLIKELY(scope.exception())) {
- JSC::Exception* exception = scope.exception();
- scope.clearException();
- return JSValue::encode(exception);
+ return JSValue::encode(scope.exception());
}
if (auto* promise = JSC::jsDynamicCast<JSPromise*>(result)) {