Skip to content

Conversation

addaleax
Copy link
Member

Handle possible JS exceptions that can occur by returning to JS land
immediately.

The motivation for this change is that USE(….FromJust()); is an
anti-pattern, and .FromJust() with an unused return value is
superseded by .Check(). However, in this case, checking that the
operation succeeded is not necessary.

Refs: #27162

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Handle possible JS exceptions that can occur by returning to JS land
immediately.

The motivation for this change is that `USE(….FromJust());` is an
anti-pattern, and `.FromJust()` with an unused return value is
superseded by `.Check()`. However, in this case, checking that the
operation succeeded is not necessary.

Refs: nodejs#27162
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. worker Issues and PRs related to Worker support. labels Apr 15, 2019
Local<String> key =
FIXED_ONE_BYTE_STRING(env->isolate(), "invalidExecArgv");
USE(args.This()->Set(env->context(), key, error).FromJust());
USE(args.This()->Set(env->context(), key, error));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add an explaining comment here? I bet it's going to look wrong to the casual reader otherwise.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, added a comment!

@nodejs-github-bot
Copy link
Collaborator

addaleax added a commit that referenced this pull request Apr 17, 2019
Handle possible JS exceptions that can occur by returning to JS land
immediately.

The motivation for this change is that `USE(….FromJust());` is an
anti-pattern, and `.FromJust()` with an unused return value is
superseded by `.Check()`. However, in this case, checking that the
operation succeeded is not necessary.

Refs: #27162

PR-URL: #27245
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@addaleax
Copy link
Member Author

Landed in 002dacb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. worker Issues and PRs related to Worker support.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants