-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src,stream: change return type to Maybe
#43575
src,stream: change return type to Maybe
#43575
Conversation
fcc16f5
to
cc16070
Compare
@nodejs/cpp-reviewers |
This changes the return types of some functions to indicate that the functions may have a pending exception, and removes some of todos related. Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
a0d6999
to
ed77f33
Compare
This seems to be the only call site for Lines 200 to 203 in 7cbcc4f
I tried to do the needful at the call site but couldn't make it up as the result. The followings are what I tried.
#include "node_errors.h"
...
using errors::TryCatchScope;
using v8::Isolate;
...
[](uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) {
{
LibuvStreamWrap* wrap = static_cast<LibuvStreamWrap*>(stream->data);
Environment* env = wrap->env();
Isolate* isolate = env->isolate();
HandleScope handle_scope(isolate);
Context::Scope context_scope(env->context());
TryCatchScope try_catch(env);
// try_catch.SetVerbose(true); // IIUC, this isn't needed but, without this, some tests fail.
if (wrap->OnUvRead(nread, buf).IsNothing()) {
DCHECK(try_catch.HasCaught() && !try_catch.HasTerminated());
Local<Value> argv[] = {
v8::Integer::New(isolate, static_cast<int32_t>(nread)),
wrap->GetObject(),
try_catch.Exception()
};
wrap->MakeCallback(env->onerror_string(), arraysize(argv), argv);
}
}
[](uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) {
{
LibuvStreamWrap* wrap = static_cast<LibuvStreamWrap*>(stream->data);
TryCatchScope try_catch(wrap->env());
try_catch.SetVerbose(true);
wrap->OnUvRead(nread, buf);
}
[](uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) {
{
LibuvStreamWrap* wrap = static_cast<LibuvStreamWrap*>(stream->data);
TryCatchScope try_catch(wrap->env());
// try_catch.SetVerbose(true); // IIUC, this shouldn't be called but, without this, some tests fail.
if (wrap->OnUvRead(nread, buf).IsNothing()) {
if (try_catch.HasCaught() && !try_catch.HasTerminated())
errors::TriggerUncaughtException(wrap->env()->isolate(), try_catch);
}
} |
ed77f33
to
2c0c91b
Compare
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
2c0c91b
to
83cafe8
Compare
Are you sure that the JS-side of the object uses an |
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
On second thought, @RaisinTen Updated the call site using a verbose TryCatch scope, PTAL. I had also considered manually triggering the LibuvStreamWrap* wrap = static_cast<LibuvStreamWrap*>(stream->data);
TryCatchScope try_catch(wrap->env());
try_catch.SetVerbose(true);
if (wrap->OnUvRead(nread, buf).IsNothing()) {
if (try_catch.HasCaught() && !try_catch.HasTerminated()) {
try_catch.SetVerbose(false);
errors::TriggerUncaughtException(wrap->env()->isolate(), try_catch);
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Landed in 141052d |
This changes the return types of some functions to indicate that the functions may have a pending exception, and removes some of todos related. Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com PR-URL: #43575 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This changes the return types of some functions to indicate that the functions may have a pending exception, and removes some of todos related. Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com PR-URL: #43575 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This changes the return types of some functions to indicate that the functions may have a pending exception, and removes some of todos related. Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com PR-URL: #43575 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This changes the return types of some functions to indicate that the functions may have a pending exception, and removes some of todos related. Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com PR-URL: nodejs/node#43575 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This changes the return types of some functions to indicate that the functions may have a pending exception.
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com