Description
Is your feature request related to a problem? Please describe.
Now we inspect the error object on fatal errors, which is awesome. I started to play with node-report recently and this feature was not incorporated there yet. I think this would make a lot of sense since it would make the report more useful for users.
Describe the solution you'd like
Take the program below as an example:
// crash.js
function crash() {
let e = new Error('boom');
e.val = 1;
throw e;
}
crash();
Today it will output the following stack trace (see how it also prints the custom attribute we added):
$ ./node ./crash.js
/home/mmarchini/workspace/nodejs/node/crash.js:5
throw e;
^
Error: boom
at crash (/home/mmarchini/workspace/nodejs/node/crash.js:3:11)
at Object.<anonymous> (/home/mmarchini/workspace/nodejs/node/crash.js:8:1)
at Module._compile (internal/modules/cjs/loader.js:779:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:790:10)
at Module.load (internal/modules/cjs/loader.js:642:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:842:10)
at internal/main/run_main_module.js:17:11 {
val: 1
}
The report for this error looks like this today:
"javascriptStack": {
"message": "[eval]:1",
"stack": [
"at crash (/home/mmarchini/workspace/nodejs/node/crash.js:3:11)",
"at Object.<anonymous> (/home/mmarchini/workspace/nodejs/node/crash.js:8:1)",
"at Module._compile (internal/modules/cjs/loader.js:779:30)",
"at Object.Module._extensions..js (internal/modules/cjs/loader.js:790:10)",
"at Module.load (internal/modules/cjs/loader.js:642:32)",
"at Function.Module._load (internal/modules/cjs/loader.js:555:12)",
"at Function.Module.runMain (internal/modules/cjs/loader.js:842:10)"
]
},
It would be amazing if we had the properties as well, as shown below:
"javascriptStack": {
"message": "[eval]:1",
"stack": [
"at crash (/home/mmarchini/workspace/nodejs/node/crash.js:3:11)",
"at Object.<anonymous> (/home/mmarchini/workspace/nodejs/node/crash.js:8:1)",
"at Module._compile (internal/modules/cjs/loader.js:779:30)",
"at Object.Module._extensions..js (internal/modules/cjs/loader.js:790:10)",
"at Module.load (internal/modules/cjs/loader.js:642:32)",
"at Function.Module._load (internal/modules/cjs/loader.js:555:12)",
"at Function.Module.runMain (internal/modules/cjs/loader.js:842:10)"
],
"errorProperties": {
"val": 1
}
},
Describe alternatives you've considered
The only alternative as powerful as this would be core dumps, but the entry barrier for core dumps is way higher than node-report.