Skip to content

Commit 6616c4f

Browse files
committed
* Throw InvalidOperationException in the case of a bug.
1 parent 6207a69 commit 6616c4f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

projects/RabbitMQ.Client/client/api/IEndpointResolverExtensions.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,16 @@ public static async Task<T> SelectOneAsync<T>(this IEndpointResolver resolver,
7171
}
7272
}
7373

74-
if (EqualityComparer<T>.Default.Equals(t!, default!) && exceptions.Count > 0)
74+
if (EqualityComparer<T>.Default.Equals(t!, default!))
7575
{
76-
throw new AggregateException(exceptions);
76+
if (exceptions.Count > 0)
77+
{
78+
throw new AggregateException(exceptions);
79+
}
80+
else
81+
{
82+
throw new InvalidOperationException(InternalConstants.BugFound);
83+
}
7784
}
7885

7986
return t!;

projects/RabbitMQ.Client/client/api/InternalConstants.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,7 @@ internal static class InternalConstants
5151
/// https://github.com/rabbitmq/rabbitmq-dotnet-client/issues/980
5252
/// </summary>
5353
internal const int DefaultRabbitMqMaxClientProvideNameLength = 3000;
54+
55+
internal const string BugFound = "BUG FOUND - please report this exception (with stacktrace) here: https://github.com/rabbitmq/rabbitmq-dotnet-client/issues";
5456
}
5557
}

0 commit comments

Comments
 (0)