Skip to content

Commit

Permalink
src: add missing TryCatch
Browse files Browse the repository at this point in the history
Otherwise re-entering V8 doesn't work as expected after exceptions
were thrown.
  • Loading branch information
verwaest authored and targos committed Jan 4, 2024
1 parent 0708737 commit 0d05f47
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/js_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ void JSStream::Finish(const FunctionCallbackInfo<Value>& args) {


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

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


Expand Down

0 comments on commit 0d05f47

Please sign in to comment.