getsentry/raven-ruby — pull request #122 by exploid (2013-07-21 11:58:09+00:00)
Title: Cleanup invalid utf8 byte sequences in the sanitize data processor.

As soon as we started using raven-sentry (replacing another service), Raven.capture_exception($!) started raising ArgumentError: "invalid byte sequence in UTF-8" coming from the sanitize data processor.

It came from our [Griddler](https://github.com/thoughtbot/griddler) endpoint, and [this post](http://robots.thoughtbot.com/post/42664369166/fight-back-utf-8-invalid-byte-sequences) by thoughtbot describes the issue that they ran into when developing Griddler, and provides a fix.

I went ahead and implemented a fix that cleans up invalid utf-8 byte sequences, including a spec for it.

We're currently running against my branch in production and haven't seen the issue again. Please let me know what you think.

On another note, my co-workers and I are under the impression that an exception logger seems like the sort of thing that should never throw an exception, under any conditions. In this case, the side-effects caused us to respond with 500's to SendGrid (could've been a user facing error as well), but we never got notified by sentry of this problem. Swallowing the exception from raven would've been just a good, if not better to prevent the user facing error.

Do you guys have thoughts on that, and would you be opened to receiving a patch?