Reducing Noisy JavaScript Errors with Rollbar

The docs didn't make it very clear exactly what I should do so here is my fix

Recently on a project we were getting lots of noisy JavaScript errors caused by a specific issue with the Safari browser over which we had no control. Rollbar has a config option which allows you to ignore specific error messages which was perfect. The issue was I just couldn’t get it formatted correctly, so I thought it would be useful to share how I got it working.

It seemed like I need to pass the error message string with any characters that needed to be escaped escaped (Here is a link for the full documentation about ignoring specific exception messages). This was not working for me. When I made the string into a regex I was able to get it working.

Here is my code for browser JS:

  var _rollbarConfig = {
    accessToken: ... // Other config code
    ignoredMessages: [/undefined is not an object \(evaluating 'r\[\"@context\"\]\.toLowerCase'\)/]
  };

Recent posts View all

Web DevProductivity

Keeping on top of website updates

Learn what website updates are, what they entail, why they are important, and how we can help

Freelancing

Getting the most out of your agency

Here are some tips based on years of working with, for, and as an agency on how to get the most out of any work you do.