Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

491
Views
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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Simple solution - log the error object as a property of a plain object

try {
    throw Error("Some error text");
}
catch( error) {
    console.log( {error});
}

This allows you to inspect and expand the structure of an error object in the same way you would any other. Best performed in a browser since code snippets don't provide inspection facilities.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!