Created
September 5, 2013 21:17
-
-
Save mrpunkin/6456305 to your computer and use it in GitHub Desktop.
Extension for ExceptionNotifier class to ignore "invalid byte sequence" errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ExceptionNotifier | |
| def call(env) | |
| @app.call(env) | |
| rescue Exception => exception | |
| options = (env['exception_notifier.options'] ||= {}) | |
| options.reverse_merge!(@options) | |
| unless Array.wrap(options[:ignore_exceptions]).include?(exception.class) or /invalid byte sequence/ =~ exception.message | |
| Notifier.exception_notification(env, exception).deliver | |
| env['exception_notifier.delivered'] = true | |
| end | |
| raise exception | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment