Skip to content

Instantly share code, notes, and snippets.

@mrpunkin
Created September 5, 2013 21:17
Show Gist options
  • Select an option

  • Save mrpunkin/6456305 to your computer and use it in GitHub Desktop.

Select an option

Save mrpunkin/6456305 to your computer and use it in GitHub Desktop.
Extension for ExceptionNotifier class to ignore "invalid byte sequence" errors.
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