How it works...
Whenever an exception occurs in our Angular application, there is a global handler that processes it at the highest level of our application. This handler usually simply pushes the error through, to console.error, but in our case we can actually override this behavior to instead send the event to Sentry.
This approach has two major advantages over traditional error handling. One is a user facing change: the error itself is invisible to the user. Even if they pull open the developer console to inspect, there is no indication of a stack trace or other error when the exception occurs. Of course, if the error breaks functionality for the user, this point is moot, but if the user doesn't notice any issue, such as a failed background ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access