Skip to content

module: fix error first line col offset - #2867

Closed
tflanagan wants to merge 1 commit into
nodejs:masterfrom
tflanagan:module-fix-error-offsets
Closed

module: fix error first line col offset#2867
tflanagan wants to merge 1 commit into
nodejs:masterfrom
tflanagan:module-fix-error-offsets

Conversation

@tflanagan

Copy link
Copy Markdown
Contributor

Rehash of nodejs/node-v0.x-archive#25342 with noted corrections.

Fixes#2860, nodejs/node-v0.x-archive#9445

I've also created another variant of this solution by adding a "\n" to the wrapper and setting the lineOffset property to -1, re: tflanagan@9d8e6a9

@kenany

Copy link
Copy Markdown
Contributor

I feel like @brendan0powers's authorship should be preserved here.

@tflanagan

Copy link
Copy Markdown
ContributorAuthor

👍

Just looking for things to do (this seemed rather important)

@brendanashworth

Copy link
Copy Markdown
Contributor

Are there any side effects of using the second commit (tflanagan@9d8e6a9)? It seems way simpler.

Comment threaddoc/api/vm.markdown

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Need to also update docs on Script constructor

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I've updated the docs in two places with the lineOffset and columnOffset parameters, and also added a missing filename and timeout parameter listings.

@cjihrig

Copy link
Copy Markdown
Contributor

I agree with @brendanashworth that the other commit looks much simpler. Does it cause any issues on Windows?

@tflanagan

Copy link
Copy Markdown
ContributorAuthor

bump for LTS? Don't want this PR to end up like @brendan0powers's

@brendanashworth

Copy link
Copy Markdown
Contributor

@tflanagan does tflanagan@489b5b4 cause any issues (perhaps windows)? I think this should be pushed instead of the other bigger commits. But this would be a candidate for LTS back-porting anyways.

@tflanagan

Copy link
Copy Markdown
ContributorAuthor

I've beening running it on windows for over 3 weeks without issues, granted any issue would only show if an error occured

@brendanashworth

Copy link
Copy Markdown
Contributor

@tflanagan could you push only that commit to this PR then? Then we can review and run the CI.

@tflanagan
tflanaganforce-pushed the module-fix-error-offsets branch from 489b5b4 to 41810b8CompareOctober 12, 2015 13:54
@tflanagan

Copy link
Copy Markdown
ContributorAuthor

@brendanashworth okay, i've rebased/amended/pushed it down to one commit with the NL approach.

$ vcbuild test nosign passed all tests

@tflanagan

Copy link
Copy Markdown
ContributorAuthor

poke

edit: poke

Comment threadtest/parallel/test-vm-context.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The first line of this comment can probably be removed.

@cjihrig

Copy link
Copy Markdown
Contributor

@tflanagan I'm interested in getting this landed. Would you mind rebasing?

@tflanagan

Copy link
Copy Markdown
ContributorAuthor

@cjihrig Rebased, running new tests now, will force push shortly

@tflanagan
tflanaganforce-pushed the module-fix-error-offsets branch from 41810b8 to 7dc621bCompareNovember 20, 2015 19:53
@tflanagan

Copy link
Copy Markdown
ContributorAuthor

@cjihrig Done.

Besides for those pesky flaky Buffer tests, it passes local tests fwiw

Edit: Fixed the docs

@tflanagan
tflanaganforce-pushed the module-fix-error-offsets branch 2 times, most recently from b28d69a to 1505c73CompareNovember 20, 2015 19:57
@tflanagan
tflanaganforce-pushed the module-fix-error-offsets branch from 1505c73 to e4281caCompareNovember 20, 2015 19:58
@cjihrig

Copy link
Copy Markdown
Contributor

@tflanagan

Copy link
Copy Markdown
ContributorAuthor

@cjihrig Looks like it passed! :) 💯

@cjihrig

Copy link
Copy Markdown
Contributor

💚 from the CI. Nice. Landing.

cjihrig pushed a commit that referenced this pull request Nov 20, 2015
Because Node modules are wrapped, errors on the first line
of a file leak the wrapper to the user and report the wrong
column number. This commit adds a line break to the module
wrapper so that the first line is treated the same as all
other lines. To compensate for the additional line, a line
offset of -1 is also applied to errors.
Fixes: #2860
PR-URL: #2867
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@cjihrig

Copy link
Copy Markdown
Contributor

Thanks! Landed in dfee4e3

@cjihrigcjihrig closed this Nov 20, 2015
@tflanagan

Copy link
Copy Markdown
ContributorAuthor

Thank you! 👍

@tflanagan
tflanagan deleted the module-fix-error-offsets branch November 20, 2015 21:43
rvagg pushed a commit that referenced this pull request Dec 5, 2015
Because Node modules are wrapped, errors on the first line
of a file leak the wrapper to the user and report the wrong
column number. This commit adds a line break to the module
wrapper so that the first line is treated the same as all
other lines. To compensate for the additional line, a line
offset of -1 is also applied to errors.
Fixes: #2860
PR-URL: #2867
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
cjihrig added a commit to cjihrig/node that referenced this pull request Dec 14, 2015
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: nodejs#2867
PR-URL: nodejs#4254
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
cjihrig added a commit that referenced this pull request Dec 14, 2015
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 <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
cjihrig added a commit that referenced this pull request Dec 15, 2015
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 <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@rvaggrvagg mentioned this pull request Dec 17, 2015
MylesBorins pushed a commit that referenced this pull request Dec 29, 2015
Because Node modules are wrapped, errors on the first line
of a file leak the wrapper to the user and report the wrong
column number. This commit adds a line break to the module
wrapper so that the first line is treated the same as all
other lines. To compensate for the additional line, a line
offset of -1 is also applied to errors.
Fixes: #2860
PR-URL: #2867
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
cjihrig added a commit that referenced this pull request Dec 30, 2015
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 <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
MylesBorins pushed a commit that referenced this pull request Jan 19, 2016
Because Node modules are wrapped, errors on the first line
of a file leak the wrapper to the user and report the wrong
column number. This commit adds a line break to the module
wrapper so that the first line is treated the same as all
other lines. To compensate for the additional line, a line
offset of -1 is also applied to errors.
Fixes: #2860
PR-URL: #2867
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jan 19, 2016
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 <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@MylesBorinsMylesBorins mentioned this pull request Jan 19, 2016
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
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: nodejs#2867
PR-URL: nodejs#4254
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

moduleIssues and PRs related to the module subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@tflanagan@kenany@brendanashworth@cjihrig@domenic@jasnell@MylesBorins