Back to Developer Roadmap

Error Monitoring

src/data/question-groups/javascript/content/error-monitoring.md

4.0733 B
Original Source

Keeping track of errors in your JavaScript application is important, especially when it's up and running and people are using it. This will allow you to find and correct mistakes to make your application reliable and easier to use.

These methods will help you keep tabs on what's happening with your application once it's in production:

  • Try-Catch Blocks: Use a try...catch block to catch errors before they cause your application to crash.
  • Track uncaught errors: Use a window.oneerror to catch errors outside a try...catch block.
  • External services: Use external services like Sentry to track errors in production.
  • Send errors to a server: Use AJAX or fetch API to send error data to the server for analysis.