How can I access the error stack in Node.js?

Responsive Ad Header

Question

Grade: Education Subject: Support
How can I access the error stack in Node.js?
Asked by:
44 Viewed 44 Answers
Responsive Ad After Question

Answer (44)

Best Answer
(249)
You can access the error stack using the `stack` property of an `Error` object. For example, if you catch an error with `try...catch`, you can access the stack like this: `error.stack`. Uncaught exceptions will also have a stack property available.