| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@nodejs/cpp-reviewers |
Sorry, something went wrong.
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
This seems to be the only call site for OnUvRead(). 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);
}
} |
Sorry, something went wrong.
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
Are you sure that the JS-side of the object uses an onerror() callback to report errors to the public API? |
Sorry, something went wrong.
Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
On second thought, onerror() callback couldn't be used for reporting errors in the LibuvStreamWrap perspective since the JS-side of the object may not use it. Then, using the uncaught exception seems to be an alternative way. @RaisinTen Updated the call site using a verbose TryCatch scope, PTAL. I had also considered manually triggering the uncaught exception as below. However, after reading #42054 (comment), I noticed SetVerbose(true) would be enough. The verbose scope would work if actual throwing exceptions occur in OnUvRead(). 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);
}
} |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
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>
| Back | FazBrowse Home | New Git URL |
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