Skip to content

Commit 30a3ffb

Browse files
committed
Change exception catching on get database for new sdk
1 parent 0549e46 commit 30a3ffb

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/NewAzureSqlDatabase.cs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Commands.Sql.Database.Model;
16-
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
16+
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
17+
using Microsoft.Rest.Azure;
1718
using System.Collections.Generic;
1819
using System.Linq;
1920
using System.Management.Automation;
@@ -132,18 +133,7 @@ protected override AzureSqlDatabaseCreateOrUpdateModel GetEntity()
132133
{
133134
ModelAdapter.GetDatabase(this.ResourceGroupName, this.ServerName, this.DatabaseName);
134135
}
135-
catch (Hyak.Common.CloudException ex) // when using Hyak SDK
136-
{
137-
if (ex.Response.StatusCode == System.Net.HttpStatusCode.NotFound)
138-
{
139-
// This is what we want. We looked and there is no database with this name.
140-
return null;
141-
}
142-
143-
// Unexpected exception encountered
144-
throw;
145-
}
146-
catch (Microsoft.Rest.Azure.CloudException ex) // when using AutoRest SDK
136+
catch (CloudException ex)
147137
{
148138
if (ex.Response.StatusCode == System.Net.HttpStatusCode.NotFound)
149139
{

src/ResourceManager/Sql/Commands.Sql/Replication/Cmdlet/NewAzureSqlDatabaseCopy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Hyak.Common;
1615
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
1716
using Microsoft.Azure.Commands.Sql.Properties;
1817
using Microsoft.Azure.Commands.Sql.Replication.Model;
18+
using Microsoft.Rest.Azure;
1919
using System.Collections;
2020
using System.Collections.Generic;
2121
using System.Linq;

src/ResourceManager/Sql/Commands.Sql/Replication/Cmdlet/NewAzureSqlDatabaseSecondary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Hyak.Common;
1615
using Microsoft.Azure.Commands.ResourceManager.Common.Tags;
1716
using Microsoft.Azure.Commands.Sql.Properties;
1817
using Microsoft.Azure.Commands.Sql.Replication.Model;
18+
using Microsoft.Rest.Azure;
1919
using System.Collections;
2020
using System.Collections.Generic;
2121
using System.Linq;

0 commit comments

Comments
 (0)