Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2c47e58

Browse filesBrowse files
cola119danielleadams
authored andcommitted
src: fix regression that a source marker is lost
PR-URL: #43086 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 5aa3b21 commit 2c47e58
Copy full SHA for 2c47e58

File tree

Expand file treeCollapse file tree

2 files changed

+11
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-3
lines changed
Open diff view settings
Collapse file

‎src/node_errors.cc‎

Copy file name to clipboardExpand all lines: src/node_errors.cc
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ static std::string GetErrorSource(Isolate* isolate,
6262
// added in the JavaScript context:
6363
Environment* env = Environment::GetCurrent(isolate);
6464
const bool has_source_map_url =
65-
!message->GetScriptOrigin().SourceMapUrl().IsEmpty();
65+
!message->GetScriptOrigin().SourceMapUrl().IsEmpty() &&
66+
!message->GetScriptOrigin().SourceMapUrl()->IsUndefined();
6667
if (has_source_map_url && env != nullptr && env->source_maps_enabled()) {
6768
return sourceline;
6869
}
Collapse file

‎test/parallel/test-error-reporting.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-error-reporting.js
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ const assert = require('assert');
2525
const exec = require('child_process').exec;
2626
const fixtures = require('../common/fixtures');
2727

28-
function errExec(script, callback) {
29-
const cmd = `"${process.argv[0]}" "${fixtures.path(script)}"`;
28+
function errExec(script, option, callback) {
29+
callback = typeof option === 'function' ? option : callback;
30+
option = typeof option === 'string' ? option : '';
31+
const cmd = `"${process.argv[0]}" ${option} "${fixtures.path(script)}"`;
3032
return exec(cmd, (err, stdout, stderr) => {
3133
// There was some error
3234
assert.ok(err);
@@ -79,3 +81,8 @@ errExec('throws_error6.js', common.mustCall((err, stdout, stderr) => {
7981
errExec('throws_error7.js', common.mustCall((err, stdout, stderr) => {
8082
assert.match(stderr, /throw {\r?\n\^\r?\n{ toString: \[Function: toString] }\r?\n\r?\nNode\.js \S+\r?\n$/);
8183
}));
84+
85+
// Regression tests for https://github.com/nodejs/node/issues/39149
86+
errExec('throws_error7.js', '--enable-source-maps', common.mustCall((err, stdout, stderr) => {
87+
assert.match(stderr, /throw {\r?\n\^\r?\n{ toString: \[Function: toString] }\r?\n\r?\nNode\.js \S+\r?\n$/);
88+
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.