How can I inspect the full details of an error object within a `catch` block?

Question

Grade: Education Subject: Support
How can I inspect the full details of an error object within a `catch` block?
Asked by:
77 Viewed 77 Answers

Answer (77)

Best Answer
(295)
To inspect the full details of an error object, you can use `console.log(error)` or `console.dir(error)` within your `catch` block. This will often display all available properties of the error object, including `name`, `message`, and potentially `stack` and others depending on the environment.