-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.wipIssues and PRs that are still a work in progress.Issues and PRs that are still a work in progress.
Description
From at least Node 4.2 the documentation says:
The first line of the trace, instead of being prefixed with
ErrorType: message, will be the result of callingtargetObject.toString().
This test program:
var assert = require('assert');
function X(msg) {
this.message = msg;
}
X.prototype.name = 'X';
X.prototype.toString = function() { return 'toString'; }
var x = new X('something');
assert.deepEqual(x, {message: 'something'});
assert.equal(x.toString(), 'toString');
Error.captureStackTrace(x);
assert.equal(x.stack.split('\n')[0], 'X: something');
proves the description incorrect. The first line is produced by deps/v8/src/messages.js in ErrorToStringDetectCycle from the name and message properties of targetObject with this logic:
if (name === "") return message;
if (message === "") return name;
return name + ": " + message;
where name defaults to "Error" and message defaults to "".
I'm not good at user-facing technical documentation so I'd rather not try to craft replacement text for something that complex.
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.wipIssues and PRs that are still a work in progress.Issues and PRs that are still a work in progress.