Look into supporting chained exceptions
We're adding support for chained exceptions in Elastic APM (see elastic/apm#40).
However, we don't have a way to chain in exceptions in Node.js, but I was thinking we might provide an API that allows the user to record such things.
E.g. it's not uncommon in Node.js to say get a low-level error back from the database driver and then throw a more high-level error. Having access to both the low and the high-level error would be useful.
I’ve seen multiple libraries for chaining exceptions implement err.cause() to receive the low level error from the high level error.
I’ve also seen logging libraries detect for that method and using it in their error pretty printing.
Food for thought: https://github.com/tc39/proposal-error-cause
With error cause being in Stage 4 perhaps it is time to support this?