Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/sneakers/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def process_work(delivery_info, metadata, msg, handler)
end
res = block_to_call.call(deserialized_msg, delivery_info, metadata, handler)
end
rescue SignalException, SystemExit
rescue SignalException, SystemExit, Bunny::Exception
# ServerEngine handles these exceptions, so they are not expected to be raised within the worker.
# Nevertheless, they are listed here to ensure that they are not caught by the rescue block below.
raise
Expand Down
8 changes: 8 additions & 0 deletions spec/sneakers/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,14 @@ def work(msg)
w.do_work(header, nil, "msg", handler)
end

it "should not catch bunny exceptions" do
w = DummyWorker.new(@queue, TestPool.new)
mock(w).work("msg").once{ raise Bunny::Exception }
assert_raises(Bunny::Exception) do
w.do_work(nil, nil, "msg", nil)
end
end

it "should log exceptions from workers" do
handler = Object.new
header = Object.new
Expand Down
Loading