-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: fix line numbers on core errors
In dfee4e3, the module wrapper and line offset used when wrapping module code was changed to better report errors on the first line of modules. However, that commit did not update the runInThisContext() call used to execute the core modules, so their error line numbers have been off by one. This commit provides the correct lineOffset for core modules. Refs: #2867 PR-URL: #4254 Reviewed-By: Brian White <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
- Loading branch information
Showing
3 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const punycode = require('punycode'); | ||
|
||
// This test verifies that line numbers in core modules are reported correctly. | ||
// The punycode module was chosen for testing because it changes infrequently. | ||
// If this test begins failing, it is likely due to a punycode update, and the | ||
// test's assertions simply need to be updated to reflect the changes. If a | ||
// punycode update was not made, and this test begins failing, then line numbers | ||
// are probably actually broken. | ||
punycode.decode('x'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
punycode.js:67 | ||
throw new RangeError(errors[type]); | ||
^ | ||
|
||
RangeError: Invalid input | ||
at error (punycode.js:67:*) | ||
at Object.decode (punycode.js:*:*) | ||
at Object.<anonymous> (*test*message*core_line_numbers.js:*:*) | ||
at Module._compile (module.js:*:*) | ||
at Object.Module._extensions..js (module.js:*:*) | ||
at Module.load (module.js:*:*) | ||
at Function.Module._load (module.js:*:*) | ||
at Function.Module.runMain (module.js:*:*) | ||
at startup (node.js:*:*) | ||
at node.js:*:* |