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

132
Views
where to implement window.onerror method on a react project

I want to send my frontend logs to backend on react project. where can i implement window.onerror method so all of the unhandled exceptions will be thrown to backend within that method.

is it possible to write this method to app.js or something so all errors will be captured. Or should I add this method to all of my components

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

this post really helped me alot github.com/facebook/react/issues/19613

I wrote below Event listener in src/index.js and it raises error

window.addEventListener('error', (event) => {
  console.log(Error(event.message ?? event));
  const { message, filename, lineno, colno, error } = event;
  console.log('Captured uncaught error:', message, filename, lineno, colno, error.stack);
})
about 4 years ago · Santiago Trujillo 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!