Skip to content
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

inspector: migrate errors from C++ to JS #19387

Closed
wants to merge 1 commit into from

Conversation

targos
Copy link
Member

@targos targos commented Mar 16, 2018

Assign a code to a user-facing error.
Turn other internal-only errors to checks.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@targos targos added inspector Issues and PRs related to the V8 inspector protocol errors Issues and PRs related to JavaScript errors originated in Node.js core. labels Mar 16, 2018
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Mar 16, 2018
@targos targos added the semver-major PRs that contain breaking changes and should be released in the next major version. label Mar 16, 2018
### ERR_INSPECTOR_ALREADY_ATTACHED

While using the `inspector` module, an attempt was made to connect a session
when another session was already attacheds.
Copy link
Member

Choose a reason for hiding this comment

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

Extra s.

Copy link
Member

@fhinkel fhinkel left a comment

Choose a reason for hiding this comment

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

LGTM with typo pointed out by @richardlau.

@targos
Copy link
Member Author

targos commented Mar 16, 2018

@targos targos force-pushed the error-codes-inspector branch from 2faae1f to 38a566e Compare March 20, 2018 12:30
@targos
Copy link
Member Author

targos commented Mar 20, 2018

<a id="ERR_INSPECTOR_ALREADY_ATTACHED"></a>
### ERR_INSPECTOR_ALREADY_ATTACHED

While using the `inspector` module, an attempt was made to connect a session
Copy link
Member

@joyeecheung joyeecheung Mar 20, 2018

Choose a reason for hiding this comment

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

Should this reuse the ERR_INSPECTOR_ALREADY_CONNECTED instead of creating a new error? From what I can tell, the only distinction is that if you connect from the same session twice, you get an ERR_INSPECTOR_ALREADY_CONNECTED, whereas if you connect from another session, you get an ERR_INSPECTOR_ALREADY_ATTACHED, but the cause are the same: there is a current connected session, whether it's the same one or a different one does not seem to make a big difference.

To get out of ERR_INSPECTOR_ALREADY_CONNECTED, the user can call.disconnect(), but there is not a method called .detach() that a user can use to get out of ERR_INSPECTOR_ALREADY_ATTACHED, they still need to .disconnect() to detach - and there is no explanation about attach in the inspector documentation. IMO the difference should probably be told in the error message, not in the code, so it's [ERR_INSPECTOR_ALREADY_CONNECTED]: the inspector session is already connected v.s. [ERR_INSPECTOR_ALREADY_CONNECTED]: another inspector session is already connected

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I'm going to change this.

Assign a code to a user-facing error.
Turn other internal-only errors to checks.
@targos targos force-pushed the error-codes-inspector branch from 38a566e to c08f887 Compare March 21, 2018 07:33
@targos
Copy link
Member Author

targos commented Mar 21, 2018

@targos
Copy link
Member Author

targos commented Mar 21, 2018

CI is green. Is everyone OK with @joyeecheung's suggestion?

@targos
Copy link
Member Author

targos commented Mar 22, 2018

Landed in 4e1f090

@targos targos closed this Mar 22, 2018
@targos targos deleted the error-codes-inspector branch March 22, 2018 07:41
targos added a commit that referenced this pull request Mar 22, 2018
Assign a code to a user-facing error.
Turn other internal-only errors to checks.

PR-URL: #19387
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Eugene Ostroukhov <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
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++. errors Issues and PRs related to JavaScript errors originated in Node.js core. inspector Issues and PRs related to the V8 inspector protocol lib / src Issues and PRs related to general changes in the lib or src directory. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants