In getErrorMessage, which is used to create a pretty error messages that is both logged and returned to clients in non-production environments, the error message is found by simply taking err.stack.
Errors now support the cause option (not really well-documented in Node.js documentation, but it's on MDN), which allows listing originating causes for an error (for example, if an error is thrown as the result of a different error).
err.stack does not print this, but for example browser consoles show the causes nicely:

Would you be interested in a PR adding the cause chain to the output of getErrorMessage? I think this would be a nice addition, and I would personally find it useful 😄
In
getErrorMessage, which is used to create a pretty error messages that is both logged and returned to clients in non-production environments, the error message is found by simply takingerr.stack.Errors now support the
causeoption (not really well-documented in Node.js documentation, but it's on MDN), which allows listing originating causes for an error (for example, if an error is thrown as the result of a different error).err.stackdoes not print this, but for example browser consoles show the causes nicely:Would you be interested in a PR adding the cause chain to the output of
getErrorMessage? I think this would be a nice addition, and I would personally find it useful 😄