Skip to content

Commit

Permalink
Better exception message when a continuation times out
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken committed May 1, 2024
1 parent 5325127 commit ced76d1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions projects/RabbitMQ.Client/client/impl/AsyncRpcContinuations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public AsyncRpcContinuation(TimeSpan continuationTimeout, CancellationToken canc
{
// Cancellation was successful, does this mean we set a TimeoutException
// in the same manner as BlockingCell used to
tcs.SetException(new TimeoutException("TODO LRB rabbitmq/rabbitmq-dotnet-client#1347"));
string msg = $"operation '{GetType().FullName}' timed out after {continuationTimeout}";
tcs.TrySetException(new TimeoutException(msg));
}
}, _tcs);
#else
Expand All @@ -79,7 +80,8 @@ public AsyncRpcContinuation(TimeSpan continuationTimeout, CancellationToken canc
{
// Cancellation was successful, does this mean we set a TimeoutException
// in the same manner as BlockingCell used to
tcs.SetException(new TimeoutException("TODO LRB rabbitmq/rabbitmq-dotnet-client#1347"));
string msg = $"operation '{GetType().FullName}' timed out after {continuationTimeout}";
tcs.TrySetException(new TimeoutException(msg));
}
}, state: _tcs, useSynchronizationContext: false);
#endif
Expand Down Expand Up @@ -109,7 +111,7 @@ public ConfiguredTaskAwaitable<T>.ConfiguredTaskAwaiter GetAwaiter()

public virtual void HandleChannelShutdown(ShutdownEventArgs reason)
{
_tcs.SetException(new OperationInterruptedException(reason));
_tcs.TrySetException(new OperationInterruptedException(reason));
}

protected virtual void Dispose(bool disposing)
Expand Down

0 comments on commit ced76d1

Please sign in to comment.