Skip to content

Commit 5070a0f

Browse files
committed
Better exception message when a continuation times out
1 parent bd1dfc2 commit 5070a0f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

projects/RabbitMQ.Client/client/impl/AsyncRpcContinuations.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ public AsyncRpcContinuation(TimeSpan continuationTimeout, CancellationToken canc
6868
{
6969
// Cancellation was successful, does this mean we set a TimeoutException
7070
// in the same manner as BlockingCell used to
71-
tcs.SetException(new TimeoutException("TODO LRB rabbitmq/rabbitmq-dotnet-client#1347"));
71+
string msg = $"operation '{GetType().FullName}' timed out after {continuationTimeout}";
72+
tcs.TrySetException(new TimeoutException(msg));
7273
}
7374
}, _tcs);
7475
#else
@@ -79,7 +80,8 @@ public AsyncRpcContinuation(TimeSpan continuationTimeout, CancellationToken canc
7980
{
8081
// Cancellation was successful, does this mean we set a TimeoutException
8182
// in the same manner as BlockingCell used to
82-
tcs.SetException(new TimeoutException("TODO LRB rabbitmq/rabbitmq-dotnet-client#1347"));
83+
string msg = $"operation '{GetType().FullName}' timed out after {continuationTimeout}";
84+
tcs.TrySetException(new TimeoutException(msg));
8385
}
8486
}, state: _tcs, useSynchronizationContext: false);
8587
#endif
@@ -109,7 +111,7 @@ public ConfiguredTaskAwaitable<T>.ConfiguredTaskAwaiter GetAwaiter()
109111

110112
public virtual void HandleChannelShutdown(ShutdownEventArgs reason)
111113
{
112-
_tcs.SetException(new OperationInterruptedException(reason));
114+
_tcs.TrySetException(new OperationInterruptedException(reason));
113115
}
114116

115117
protected virtual void Dispose(bool disposing)

0 commit comments

Comments
 (0)