Skip to content

Commit

Permalink
added more logger messages
Browse files Browse the repository at this point in the history
  • Loading branch information
raghuramg committed Feb 3, 2025
1 parent c78a55e commit a5fcf66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/event_source/protocols/amqp/bunny_queue_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ def decode_payload(payload)
if output.success?
output.value!
else
logger.error '*' * 40
logger.error payload.encoding if payload.respond_to?(:encoding)
logger.error payload.inspect
logger.error "Failed to decode message \n due to: #{output.failure} \n payload: #{payload}"
raise EventSource::Error::PayloadDecodeError, output.failure
end
Expand Down
3 changes: 3 additions & 0 deletions spec/event_source/protocols/amqp/bunny_queue_proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@
end

it 'logs the error and raises a PayloadDecodeError' do
expect(instance.logger).to receive(:error).with('*' * 40)
expect(instance.logger).to receive(:error).with(payload.encoding) if payload.respond_to?(:encoding)
expect(instance.logger).to receive(:error).with(payload.inspect)
expect(instance.logger).to receive(:error).with("Failed to decode message \n due to: #{failure_message} \n payload: #{payload}")
expect do
instance.decode_payload(payload)
Expand Down

0 comments on commit a5fcf66

Please sign in to comment.