FEATURE: Discoruse.handle_exception

to report exception via sidekiq helper, adds extra context
This commit is contained in:
Sam Saffron
2014-02-21 14:30:25 +11:00
parent d95887c57d
commit 2ab76f60d1
4 changed files with 39 additions and 6 deletions

View File

@ -4,6 +4,21 @@ require_dependency 'auth/default_current_user_provider'
module Discourse
class SidekiqExceptionHandler
extend Sidekiq::ExceptionHandler
end
def self.handle_exception(ex, context=nil, parent_logger = nil)
context ||= {}
parent_logger ||= SidekiqExceptionHandler
cm = RailsMultisite::ConnectionManagement
parent_logger.handle_exception(ex, {
current_db: cm.current_db,
current_hostname: cm.current_hostname
}.merge(context))
end
# Expected less matches than what we got in a find
class TooManyMatches < Exception; end