Slightly improved logging to fix #28
Logging the body is not worth it at the moment, as the original issue regarding corrupt body contents has been fixed already
This commit is contained in:
parent
f4d008d6a9
commit
e9a7e32bf5
@ -42,11 +42,18 @@ namespace Tapeti.Connection
|
|||||||
public async Task<ConsumeResult> Consume(string exchange, string routingKey, IMessageProperties properties, byte[] body)
|
public async Task<ConsumeResult> Consume(string exchange, string routingKey, IMessageProperties properties, byte[] body)
|
||||||
{
|
{
|
||||||
object message = null;
|
object message = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
message = messageSerializer.Deserialize(body, properties);
|
message = messageSerializer.Deserialize(body, properties);
|
||||||
if (message == null)
|
if (message == null)
|
||||||
throw new ArgumentException("Message body could not be deserialized into a message object", nameof(body));
|
throw new ArgumentException($"Message body for routing key '{routingKey}' could not be deserialized into a message object", nameof(body));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new ArgumentException($"Message body for routing key '{routingKey}' could not be deserialized into a message object: {e.Message}", nameof(body), e);
|
||||||
|
}
|
||||||
|
|
||||||
return await DispatchMessage(message, new MessageContextData
|
return await DispatchMessage(message, new MessageContextData
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user