Skip to content

Commit 81a4a99

Browse files
Fix exception for cbs link failure
1 parent 4b240af commit 81a4a99

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

iothub/device/src/Transport/AmqpIoT/AmqpIoTCbsLink.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Microsoft.Azure.Devices.Client.Exceptions;
77
using Microsoft.Azure.Amqp;
88
using Microsoft.Azure.Devices.Shared;
9+
using Microsoft.Azure.Devices.Client.Extensions;
910

1011
namespace Microsoft.Azure.Devices.Client.Transport.AmqpIoT
1112
{
@@ -25,9 +26,17 @@ public async Task<DateTime> SendTokenAsync(ICbsTokenProvider tokenProvider, Uri
2526
{
2627
return await _amqpCbsLink.SendTokenAsync(tokenProvider, namespaceAddress, audience, resource, requiredClaims, timeout).ConfigureAwait(false);
2728
}
28-
catch (AmqpException ex)
29+
catch (AmqpException e) when (!e.IsFatal())
2930
{
30-
throw new IotHubCommunicationException("AmqpIoTCbsLink.SendTokenAsync error", ex.InnerException);
31+
Exception ex = AmqpIoTExceptionAdapter.ConvertToIoTHubException(e);
32+
if (ReferenceEquals(e, ex))
33+
{
34+
throw;
35+
}
36+
else
37+
{
38+
throw ex;
39+
}
3140
}
3241
finally
3342
{

0 commit comments

Comments
 (0)