Skip to content

Commit ccc52fa

Browse files
authored
[KeyVault] Fix bug when exception.Response is null (#19558)
* fix bug when exception.Response is null * add change log
1 parent accc2f9 commit ccc52fa

File tree

5 files changed

+5
-4
lines changed

5 files changed

+5
-4
lines changed

src/KeyVault/KeyVault/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed the exception content swallowed issue when exception.Response is null [#19531]
2122

2223
## Version 4.7.0
2324
* Fixed parameter validation logic of `-UseDefaultCVMPolicy`

src/KeyVault/KeyVault/Commands/Certificate/Contact/AddAzureKeyVaultCertificateContact.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public override void ExecuteCmdlet()
110110
}
111111
catch (KeyVaultErrorException exception)
112112
{
113-
if (exception.Response.StatusCode != System.Net.HttpStatusCode.NotFound)
113+
if (exception.Response?.StatusCode != System.Net.HttpStatusCode.NotFound)
114114
{
115115
throw;
116116
}

src/KeyVault/KeyVault/Commands/Certificate/Contact/GetAzureKeyVaultCertificateContact.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public override void ExecuteCmdlet()
9393
}
9494
catch (KeyVaultErrorException exception)
9595
{
96-
if (exception.Response.StatusCode != System.Net.HttpStatusCode.NotFound)
96+
if (exception.Response?.StatusCode != System.Net.HttpStatusCode.NotFound)
9797
{
9898
throw;
9999
}

src/KeyVault/KeyVault/Commands/Certificate/Contact/RemoveAzureKeyVaultCertificateContact.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public override void ExecuteCmdlet()
110110
}
111111
catch (KeyVaultErrorException exception)
112112
{
113-
if (exception.Response.StatusCode != System.Net.HttpStatusCode.NotFound)
113+
if (exception.Response?.StatusCode != System.Net.HttpStatusCode.NotFound)
114114
{
115115
throw;
116116
}

src/KeyVault/KeyVault/Commands/Certificate/Policy/GetAzureKeyVaultCertificatePolicy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public override void ExecuteCmdlet()
8686
}
8787
catch (KeyVaultErrorException exception)
8888
{
89-
if (exception.Response.StatusCode != System.Net.HttpStatusCode.NotFound)
89+
if (exception.Response?.StatusCode != System.Net.HttpStatusCode.NotFound)
9090
{
9191
throw;
9292
}

0 commit comments

Comments
 (0)