Skip to content

Commit

Permalink
Throw ServiceBusCommunicationException instead of InvalidOperationExc…
Browse files Browse the repository at this point in the history
…eption when you try to create a session/link at the same time when connection/session is being closed. (#6940)

Throw ServiceBusCommunicationException instead of InvalidOperationException when you try to create a session/link at the same time when connection/session is being closed.
  • Loading branch information
nemakam authored Jul 16, 2019
1 parent 00f0584 commit f8d3ee8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ public static Exception GetClientException(Exception exception, string reference

case TimeoutException _:
return new ServiceBusTimeoutException(message, aggregateException);

case InvalidOperationException _ when connectionError:
return new ServiceBusCommunicationException(message, aggregateException);
}

return aggregateException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public async Task<Tuple<AmqpObject, DateTime>> CreateAndOpenAmqpLinkAsync()
{
MessagingEventSource.Log.AmqpSessionCreationException(this.entityPath, amqpConnection, exception);
session?.Abort();
throw AmqpExceptionHelper.GetClientException(exception, null, session.GetInnerException());
throw AmqpExceptionHelper.GetClientException(exception, null, session.GetInnerException(), amqpConnection.IsClosing());
}

AmqpObject link = null;
Expand Down

0 comments on commit f8d3ee8

Please sign in to comment.