Amio.io
Amio.io

Reputation: 21575

Express: next(err) stacktrace

I find it difficult to find where the error occured when using next(err). Is there a way how to save the stack to trace the error back to the original files? (Even if it was a validation error I would like to know the exact place from where it originated.)

Upvotes: 1

Views: 269

Answers (1)

Johannes Merz
Johannes Merz

Reputation: 3342

You can add error.stack to your error handling.

console.log(error, error.stack)

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack

Upvotes: 2

Related Questions