Skip to content

Conversation

@myndzi
Copy link

@myndzi myndzi commented Mar 26, 2016

The docs here: https://nodejs.org/api/errors.html#errors_error_capturestacktrace_targetobject_constructoropt

claim that the target of the captureStackTrace method's .toString method will be used to generate the error message line, but it doesn't seem to be so, at least on versions 5.3 and 5.9.1. Instead, just the vague string 'Error' is produced. This patch will replace either 'Error' or '[Object object]' at the start of the line with the custom message, instead of just '[Object object]'. It's worth noting that the test suite fails on recent versions of nodes for this reason, so I didn't need to add any tests to validate this patch -- they are already there.

Closes #14

@bodenr
Copy link
Owner

bodenr commented Mar 31, 2016

@myndzi thanks for this report and merge request.

It appears there's already a node issue for this: nodejs/node#5675
However it's currently marked as a doc issue. As you can see in my recent update to that issue, I would assert this is a (regression), bug... We'll see what they say.

In the meantime I have no problems merging your "workaround". However can I ask one thing -- would you mind just adding a TODO comment with a link to the node bug so that we can easily identify the root cause?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants