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

Document MODULE_NOT_FOUND #21894

Conversation

DullReferenceException
Copy link

@DullReferenceException DullReferenceException commented Jul 19, 2018

Document MODULE_NOT_FOUND

Checklist

Document MODULE_NOT_FOUND as a possible code for errors.

Fixes: #21890

Document `MODULE_NOT_FOUND` as a possible `code` for errors.
@@ -542,6 +542,7 @@ A reference to the current module, see the section about the
[`module` object][]. In particular, `module.exports` is used for defining what
a module exports and makes available through `require()`.

<a id="require"></a>
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't necessary as the html generator for the markdown will create these id attributes automatically.

@@ -1886,3 +1892,4 @@ Creation of a [`zlib`][] object failed due to incorrect configuration.
[try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch
[vm]: vm.html
[WHATWG Supported Encodings]: util.html#util_whatwg_supported_encodings
[`require`]: modules.html#require
Copy link
Contributor

@mscdex mscdex Jul 19, 2018

Choose a reason for hiding this comment

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

The right-hand side of this should be modules.html#modules_require instead.

Copy link
Contributor

@vsemozhetbyt vsemozhetbyt left a comment

Choose a reason for hiding this comment

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

Some nits)

@@ -1886,3 +1892,4 @@ Creation of a [`zlib`][] object failed due to incorrect configuration.
[try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch
[vm]: vm.html
[WHATWG Supported Encodings]: util.html#util_whatwg_supported_encodings
[`require`]: modules.html#modules_require
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. It seems this should be:
[`require()`]: modules.html#modules_require
  1. We usually sort bottom references ASCII-wise, so this need to be placed after the [`require('crypto').setEngine()`]: item.

@@ -1831,6 +1831,11 @@ unknown file extension.

Creation of a [`zlib`][] object failed due to incorrect configuration.

### MODULE_NOT_FOUND
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Should not this be ### ERR_MODULE_NOT_FOUND and be placed in a sorted way?
  2. It seems this doc does need <a id=... fragments.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the actual error name is currently just MODULE_NOT_FOUND.

Copy link
Contributor

Choose a reason for hiding this comment

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

So this is the first error name out of the common name pattern?

@@ -1831,6 +1831,11 @@ unknown file extension.

Creation of a [`zlib`][] object failed due to incorrect configuration.

### MODULE_NOT_FOUND

A module file could not be resolved while attempting a [`require`][] or
Copy link
Contributor

Choose a reason for hiding this comment

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

[`require`][] -> [`require()`][]

@mscdex
Copy link
Contributor

mscdex commented Jul 19, 2018

Leaving the added anchor in errors.md is fine for consistency, I honestly do not know why they are being explicitly added in that file, even after looking at the original PR where the first documented errors were added.

/cc @jasnell

@vsemozhetbyt vsemozhetbyt added doc Issues and PRs related to the documentations. module Issues and PRs related to the module subsystem. errors Issues and PRs related to JavaScript errors originated in Node.js core. labels Jul 19, 2018
@jasnell
Copy link
Member

jasnell commented Jul 20, 2018

The anchors are added to explicitly ensure that the exact error code can be used as an anchor in the docs rather than the anchor generated by the markdown rendering...

e.g. https://nodejs.org/dist/latest-v10.x/docs/api/errors.html#ERR_AMBIGUOUS_ARGUMENT as opposed to https://nodejs.org/dist/latest-v10.x/docs/api/errors.html#errors_err_ambiguous_argument

@@ -1831,8 +1831,13 @@ unknown file extension.

Creation of a [`zlib`][] object failed due to incorrect configuration.

[`'uncaughtException'`]: process.html#process_event_uncaughtexception
### MODULE_NOT_FOUND
Copy link
Member

Choose a reason for hiding this comment

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

It is very unfortunate that this does not have the ERR_ prefix :-(

Copy link
Member

Choose a reason for hiding this comment

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

The code is 7 years old so we can't blame anyone for that : 3f987cd

@@ -1831,8 +1831,13 @@ unknown file extension.

Creation of a [`zlib`][] object failed due to incorrect configuration.

[`'uncaughtException'`]: process.html#process_event_uncaughtexception
### MODULE_NOT_FOUND
Copy link
Member

Choose a reason for hiding this comment

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

This definitely needs to include the <a id="#MODULE_NOT_FOUND"></a> anchor

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt pushed a commit that referenced this pull request Jul 22, 2018
Document `MODULE_NOT_FOUND` as a possible `code` for errors.

Also, some missorting of bottom references was fixed in passing.

PR-URL: #21894
Fixes: #21890
Reviewed-By: James M Snell <[email protected]>
@vsemozhetbyt
Copy link
Contributor

Landed in 87f7671
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. errors Issues and PRs related to JavaScript errors originated in Node.js core. module Issues and PRs related to the module subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doc - Document MODULE_NOT_FOUND error code
6 participants