Skip to content

Commit

Permalink
Restore compatibility with two-arg error handlers, #5579
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Oct 20, 2022
1 parent 44e4d40 commit 02153c1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/sidekiq/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class Config
reloader: proc { |&block| block.call }
}

ERROR_HANDLER = ->(ex, ctx, cfg = Sidekiq.default_configuration) {
ERROR_HANDLER = ->(ex, ctx) {
cfg = ctx[:_config] || Sidekiq.default_configuration
l = cfg.logger
l.warn(Sidekiq.dump_json(ctx)) unless ctx.empty?
l.warn("#{ex.class.name}: #{ex.message}")
Expand Down Expand Up @@ -256,8 +257,9 @@ def handle_exception(ex, ctx = {})
if @options[:error_handlers].size == 0
p ["!!!!!", ex]
end
ctx[:_config] = self
@options[:error_handlers].each do |handler|
handler.call(ex, ctx, self)
handler.call(ex, ctx)
rescue => e
l = logger
l.error "!!! ERROR HANDLER THREW AN ERROR !!!"
Expand Down

0 comments on commit 02153c1

Please sign in to comment.