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 Dev

Updating payment method email addresses in Stripe

You can't update the email address associated with a payment method in Stripe via their dashboard, you need to use the Stripe CLI

Ruby

Irreversible Rails Migrations

What are irreversible migrations and how might we use them to our advantage?