Throwing a JavaScript Error test to your observability tool? There’s a better way.

Throwing JS errors crashes the application, and even in testing this can be disruptive. Who wants to see a white screen? It’s also unnecessary; use your observability library instead!

Instead of this:

throw new Error('Aggressively testing Sentry')

Do this (Sentry example):

Sentry.captureException(new Error('Quietly testing Sentry'));

This logs an exception with no crash.