Skip to content

How to print Error object

Daisho Komiyama edited this page Sep 21, 2022 · 1 revision

When you want to see what error object contains, but console.log(error) doesn't work.

Even console.log(error.toString()) or console.log(JSON.stringify(error)) don't work.

But this works.

console.log(JSON.stringify(error, Object.getOwnPropertyNames(error)))
Clone this wiki locally