Skip to content

Commit 0d05f47

Browse files
verwaesttargos
authored andcommitted
src: add missing TryCatch
Otherwise re-entering V8 doesn't work as expected after exceptions were thrown.
1 parent 0708737 commit 0d05f47

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/js_stream.cc

+2
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ void JSStream::Finish(const FunctionCallbackInfo<Value>& args) {
162162

163163

164164
void JSStream::ReadBuffer(const FunctionCallbackInfo<Value>& args) {
165+
v8::TryCatch try_catch(args.GetIsolate());
165166
JSStream* wrap;
166167
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());
167168

@@ -182,6 +183,7 @@ void JSStream::ReadBuffer(const FunctionCallbackInfo<Value>& args) {
182183
len -= static_cast<int>(avail);
183184
wrap->EmitRead(avail, buf);
184185
}
186+
if (try_catch.HasCaught()) try_catch.ReThrow();
185187
}
186188

187189

0 commit comments

Comments
 (0)