Rethinking front-end error reporting
Tags: javascript, errorreporting, webdev, frontenddev
Published: 2018-03-27 21:51:35

---
title: "Rethinking front-end error reporting"
published: true
tags: javascript,error-reporting,web-development,front-end-developmen
canonical_url: https://blog.logrocket.com/rethinking-front-end-error-reporting-659db3950db3
---

![](https://cdn-images-1.medium.com/max/1024/1*RZ2lM3IngWe8yuIu6KWw5A.png)

Understanding problems in web apps is hard. Between mysterious JavaScript errors, user-reported bugs, and issues caught in QA, there’s a constant struggle to get ahead of the problems affecting your users. And these are just the obvious issues — most bugs are never actually reported since users who have a bad experience just leave or suffer in&nbsp;silence.

Traditional error-reporting tools (like BugSnag, Sentry, and Rollbar) only solve part of the problem. Originally designed for logging server-side errors, they later added browser SDKs as front-end applications grew more complex. While these tools capture some useful information like stack traces and metadata, many teams find that their alerting is too noisy (too many false positives to be useful), and that they don’t capture enough context to elucidate complicated issues.

### Front-end is different

Investigating front-end and backend errors are very different processes. Server-side code runs on a single platform. Often, the only state in the system that can cause hard-to-reproduce errors comes from easily logged events like database or cache queries. When an unhandled exception in server code takes place, it usually means there is a clear-cut problem that needs to be&nbsp;fixed.

On the front-end, things aren’t so simple. The average web application runs in over 15 different browsers, across hundreds of device types. State can be highly complex, coming from memory, local storage, local databases, service workers, and APIs. A web app must be robust to connectivity issues and cross-browser differences, and unlike the backend where exceptions are usually clear-cut, it can be tricky to gauge the impact on the frontend.

![](https://cdn-images-1.medium.com/max/1024/1*iM58m5_7buKXkbThpykXKw.png)

Given the frequency and diversity of errors that front-end developers see, the most important question becomes, _did this affect the user?_ Unfortunately, looking at just a stack trace and an exception message, it’s very difficult to know. Is this a P0 crippling bug? Or maybe just a nuisance.

### Answering the right questions

[![](https://cdn-images-1.medium.com/max/1024/1*x-zMtnqUPMHnH1_451tCtA.png)](https://www.xkcd.com/1700/)<figcaption>You never quite know how things will break. (credit: xkcd.com)</figcaption>

Two years ago, we started thinking about what the perfect front-end bug report would look like. Clearly, it would collect basic information like a stack trace, metadata, and frequency histograms. But to really gauge the impact on the user, especially for hard-to-reproduce bugs, it has to let you actually _see_ what happened.

LogRocket is our audacious attempt at doing just that — reproducing an issue as if it happened in your own&nbsp;browser.

![](https://cdn-images-1.medium.com/max/1024/1*7jjY7mzUUvKKVoumPnNEdA.png)

### It’s all in the&nbsp;video

At the center of a LogRocket error report is a pixel-perfect video that accurately captures what the user saw on screen. In order to do this without any performance impact, LogRocket instruments the DOM to record the HTML and CSS on the page at the time of the&nbsp;issue.

In addition, LogRocket records console logs, JavaScript errors, stacktraces, network requests/responses with headers + bodies, browser metadata, and custom logs. It also has deep integrations with libraries like React, Redux, and Angular to log actions and application state.

![](https://cdn-images-1.medium.com/max/1024/1*SEE7Ol9Wlnx6NIuhU7CBlQ.png)

Watching the video is the fastest way to quickly know if an exception actually affected the user. And if it did, you can easily figure out what happened by reviewing network requests, logs, and application state.

### User-reported bugs
<style>body[data-twttr-rendered="true"] {background-color: transparent;}.twitter-tweet {margin: auto !important;}</style>> [@LogRocketJS](http://twitter.com/LogRocketJS "Twitter profile for @LogRocketJS") Hey guys, are you ok? Looks like you're down [https://t.co/ZLZCsvtzc3](https://t.co/ZLZCsvtzc3)
> 
>  — [@StanBoyet](https://twitter.com/StanBoyet/status/912594977670262784)<script src="//platform.twitter.com/widgets.js" charset="utf-8"></script><script>function notifyResize(height) {height = height ? height : document.documentElement.offsetHeight; var resized = false; if (window.donkey && donkey.resize) {donkey.resize(height); resized = true;}if (parent && parent._resizeIframe) {var obj = {iframe: window.frameElement, height: height}; parent._resizeIframe(obj); resized = true;}if (window.location && window.location.hash === "#amp=1" && window.parent && window.parent.postMessage) {window.parent.postMessage({sentinel: "amp", type: "embed-size", height: height}, "*");}if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.resize) {window.webkit.messageHandlers.resize.postMessage(height); resized = true;}return resized;}twttr.events.bind('rendered', function (event) {notifyResize();}); twttr.events.bind('resize', function (event) {notifyResize();});</script><script>if (parent && parent._resizeIframe) {var maxWidth = parseInt(window.frameElement.getAttribute("width")); if ( 500 < maxWidth) {window.frameElement.setAttribute("width", "500");}}</script>

When users ask for help, whether through a help desk, email, or worst of all, on Twitter — it is crucial that support and developers can quickly understand what went wrong. Unfortunately this typically means asking the user for screenshots, logs, and steps to reproduce.

With LogRocket, you can just search for a user and replay sessions where they encountered issues or asked for support. We’ve built integrations with most help desks like Intercom to let you view the user’s history directly from a&nbsp;chat.

![](https://cdn-images-1.medium.com/max/1024/1*dYWBFW6Bb1R__isM04y87Q.png)

Sometimes, it’s unclear if a user is just confused, or actually experiencing a bug. By reviewing the video replay, console and network logs from their session, you can easily make this distinction.

### Most bugs aren’t explicit exceptions

While monitoring and fixing JavaScript exceptions is crucial to application health, the reality is that the majority of problems users experience aren’t explicit code errors and aren’t ever reported. UI glitches, slow performance, broken interfaces, and even confusing UX all negatively affect user happiness and your bottom&nbsp;line.

If front-end teams want to be able to ship new features quickly, they must have confidence that these issues are being proactively detected and surfaced.

Furthermore, issues of any type must be trustworthy — if there are too many false positives, alerts will simply be&nbsp;ignored.

### Our mission: Surface all front-end problems that negatively affect&nbsp;users

![](https://cdn-images-1.medium.com/max/1024/1*4XJU0jQ1Q-EyuQ5nvkKXCQ.png)

JavaScript exceptions are just the first type of “issue” that we’ve started surfacing in LogRocket. The telemetry we’re collecting on the front-end lets us detect performance issues, broken interfaces, confusing UX, and more. We’ve started working with a select group of our customers like Reddit, Twitch, and AOL to surface these issues and will be rolling out to more customers in the next few&nbsp;months.

If you’re an existing LogRocket customer or want to start working with us, [get in touch](mailto:support@logrocket.com) and you can join the&nbsp;beta.

### Front-end is the&nbsp;future

The shift toward rich single page apps has undoubtedly improved both user experience quality and developer productivity. But with greater complexity comes the need for more observability. Existing tooling is not yet sufficient for teams to have confidence in the front-end code they&nbsp;ship.

At LogRocket, we’ve taken what we believe is a big step toward a solution — but there’s lots more work to do. If you want to help define the next generation of tooling for front-end developers, we’d love to meet you. We’re [hiring](https://logrocket.com/company)&nbsp;:)

* * *