Node: Error `message` property contains call stack information in Node 12

Created on 24 Apr 2019  路  2Comments  路  Source: nodejs/node

Hello
Starting from Node version 12 the Cannot find module error contains stack information inside of a message property.
However, in the 10 version the error message didn't contain the stack information in the message property.
Will this inconsistency be fixed?
You can easily reproduce it by the following code:

try {
    require('non-existing-module')
}
catch (err) {
    console.log(err.message);
}

My console output:

Cannot find module 'non-existing-module'
Require stack:
- D:\Projects\testcafe\non-existing-module.js


Node version 12
Windows 64

module question

Most helpful comment

This is an intentional semver-major change. See https://github.com/nodejs/node/pull/25690

Is there any issue around this? It should improve debugging overall.

All 2 comments

This is an intentional semver-major change. See https://github.com/nodejs/node/pull/25690

Is there any issue around this? It should improve debugging overall.

There is no issue. Thank you for your information and for pointing out to the PR

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stevenvachon picture stevenvachon  路  3Comments

sandeepks1 picture sandeepks1  路  3Comments

willnwhite picture willnwhite  路  3Comments

seishun picture seishun  路  3Comments

dfahlander picture dfahlander  路  3Comments