'Javascript console.log errors: how to see the real object of the Error

When console.logging errors, the browser prints a differently styled output than if it were a normal object. How can you force Google / Firefox to print the real object of the Error class instead of the stylized less useful 'error' output?

I know for example the object contains e.message and e.response for example, which you can never deduct from the Browsers log outputs.

api
  .post('/post/create', formData)
  .then((res) => {
  })
  .catch((e) => {
    // doesn't print the error object
    // doesn't print the error object
    // doesn't print the error object
    console.log(e)

    // UPDATE, destructuring does print the full Error object
    // UPDATE, destructuring does print the full Error object
    // UPDATE, destructuring does print the full Error object
    console.log('full error object', {e})
  })

Firefox Chrome

Update after approved answer. Now I got the full error object.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source