All sentry issues showing up as 'undefined'

I am trying to integrate Sentry into my React application. I’ve overriden console.error to send to sentry like so:

<script src="https://cdn.ravenjs.com/3.7.0/raven.min.js" crossorigin="anonymous"></script>
    <script>
      Raven.config('my-url').install();

      var originalConsoleError = console.error;
      console.error = function(message, error) {
        Raven.captureException(error);
        originalConsoleError.apply(this, arguments);
      }
    </script>

This is to capture all console.error logs and send those as events up to Sentry… Unfortunately, this appears to be breaking.

Not really sure how to debug this…Can anybody guide me on what I’m doing wrong here? I eventually see my error in the stack trace if I dig into an error, but at the top level the information isn’t useful like this

The issue is youre passing a string to captureError. You’d want to use captureMessage here instead.

Thanks for the reply - progress! Still doesn’t seem like the right info is getting formatted though.

[image removed here, since new users can only have 1 image per post. the title says ‘undefined’ with https://localhost:8000 underneath it]

Looking into the stack trace, I see the real error with ‘undefined’ above it

All I can really say is it sounds like whatever Parma is being passed is invalid or undefined. A strong should be passed to captureMessage and an Error object to captureException. Can you confirm that’s true?

Are you positive that React consistently sends a second argument to console.error? It seems like it’s probably just outputting a message via console.error, and the 2nd argument is always undefined.

I think you’re right. It looks like we aren’t getting the error, only the message. My bad, thanks for the help guys!