Learn more about Israeli war crimes in Gaza, funded by the USA, Germany, the UK and others.

How can I capture all crashes in a web page?

Services like Sentry have JS libraries that capture things that go wrong in your web page. How do they work?

There are many kinds of “things that can go wrong”, and they must be captured in different ways:

Note there is also window.onerror, an old and non-standard API which seems to capture the same errors as window.addEventListener("error"). I don’t see a reason to use it.

Below is a small playground demonstrating these different kinds of crashes.

Tagged #programming, #web.

Similar posts

More by Jim

Want to build a fantastic product using LLMs? I work at Granola where we're building the future IDE for knowledge work. Come and work with us! Read more or get in touch!

This page copyright James Fisher 2024. Content is not associated with my employer. Found an error? Edit this page.