From 347e78f7e68d8e8645994688c71ee56397e2c592 Mon Sep 17 00:00:00 2001 From: Toon Verwaest Date: Fri, 1 Dec 2023 02:19:58 +0100 Subject: [PATCH] src: add missing TryCatch Otherwise re-entering v8 doesn't work as expected after exceptions were thrown. --- src/js_stream.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/js_stream.cc b/src/js_stream.cc index af10fcac399..625e92eb0e8 100644 --- a/src/js_stream.cc +++ b/src/js_stream.cc @@ -162,6 +162,7 @@ void JSStream::Finish(const FunctionCallbackInfo& args) { void JSStream::ReadBuffer(const FunctionCallbackInfo& args) { + v8::TryCatch try_catch(args.GetIsolate()); JSStream* wrap; ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder()); @@ -182,6 +183,7 @@ void JSStream::ReadBuffer(const FunctionCallbackInfo& args) { len -= static_cast(avail); wrap->EmitRead(avail, buf); } + if (try_catch.HasCaught()) try_catch.ReThrow(); }