Skip to content

Conversation

@mhdawson
Copy link
Member

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc, errors

@nodejs-github-botnodejs-github-bot added the doc Issues and PRs related to the documentations. label Jul 12, 2017
@mhdawsonmhdawson requested a review from jasnellJuly 12, 2017 21:48
as we can trust the error helper implementation. An example of this kind of
error would be:

```
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: language labels (js) after code backticks.

Copy link
Contributor

@vsemozhetbytvsemozhetbytJul 12, 2017

Choose a reason for hiding this comment

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

Linter errors when the language added:

 94:1 error Expected indentation of 2 spaces but found 4 indent 95:1 error Expected indentation of 2 spaces but found 4 indent 107:1 error Expected indentation of 0 spaces but found 1 indent 108:1 error Expected indentation of 2 spaces but found 4 indent 109:1 error Expected indentation of 0 spaces but found 2 indent 110:1 error Expected indentation of 2 spaces but found 4 indent 111:1 error Expected indentation of 2 spaces but found 4 indent 112:1 error Expected indentation of 0 spaces but found 2 indent

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Thanks for catching that.

@vsemozhetbytvsemozhetbyt added errors Issues and PRs related to JavaScript errors originated in Node.js core. test Issues and PRs related to the tests. labels Jul 12, 2017
Copy link
Contributor

@refackrefack left a comment

Choose a reason for hiding this comment

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

% lint

```

One final note is that it is bad practice to change the format of the message
after the error has been created and should avoided. If it does make sense
Copy link
Member

Choose a reason for hiding this comment

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

should avoided -> should be avoided

Although I'd rewrite this entire sentence as:

Avoid changing the format of the message after the error has been created.

Copy link
Member

Choose a reason for hiding this comment

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

Or even (if this is what is meant):

Avoid changing existing messages.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Took first suggested alternative sentence.

E('ERR_SOCKET_ALREADY_BOUND', 'Socket is already bound');
```

If the error message is not a constant string then test(s) to validate
Copy link
Contributor

Choose a reason for hiding this comment

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

Drop the parens in (s).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

done

If the error message is not a constant string then test(s) to validate
the formatting of the message based on the parameters used when
creating the error should be added to
`.../test/parallel/test-internal-errors.js`. These tests should validate
Copy link
Contributor

Choose a reason for hiding this comment

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

Drop the .../

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

done

creating the error should be added to
`.../test/parallel/test-internal-errors.js`. These tests should validate
all of the different ways parameters can be used to generate the final
message string. As simple example would be:
Copy link
Contributor

Choose a reason for hiding this comment

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

As -> A
would be -> is

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

done

@mhdawson
Copy link
MemberAuthor

@vsemozhetbyt@Trott@cjihrig pushed change to address comments.

@mhdawsonmhdawson self-assigned this Jul 13, 2017
In addition, there should also be tests which validate the use of the
error based on where it is used in the codebase. For these tests, except in
special cases, they should only validate that the expected code is received
and NOT validate the massage. This will reduce the amount of test change
Copy link
Member

Choose a reason for hiding this comment

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

s/massage/message/

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

done

@mhdawson
Copy link
MemberAuthor

@vsemozhetbyt
Copy link
Contributor

Linter CI is green.

@refack
Copy link
Contributor

mdlint is clean also:

D:\code\node-github-desktop\doc\guides$ node "D:\code\4node\mdlint\node_modules\remark-cli\cli.js" --rc-path "D:\code\4node\mdlint\remarkrc.txt" -f ./*.md ./backporting-to-release-lines.md: no issues found ./building-node-with-ninja.md: no issues found ./maintaining-V8.md: no issues found ./using-internal-errors.md: no issues found ./writing-and-running-benchmarks.md: no issues found ./writing-tests.md: no issues found 

@mhdawson
Copy link
MemberAuthor

CI was green, will land

@mhdawson
Copy link
MemberAuthor

Landed as 9ab63d6

mhdawson added a commit that referenced this pull request Jul 18, 2017
PR-URL: #14207 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
@addaleaxaddaleax mentioned this pull request Jul 18, 2017
addaleax pushed a commit that referenced this pull request Jul 18, 2017
PR-URL: #14207 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fishrock123 pushed a commit that referenced this pull request Jul 19, 2017
PR-URL: #14207 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docIssues and PRs related to the documentations.errorsIssues and PRs related to JavaScript errors originated in Node.js core.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@mhdawson@vsemozhetbyt@refack@jasnell@Trott@lpinca@cjihrig@MylesBorins@nodejs-github-bot