Skip to content

Commit ea445b0

Browse files
committed
Throwing exception if OperationStatus is failed. Allso made some chagged in format.ps1xml for AzureBackupItem.
1 parent 2bc0081 commit ea445b0

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletBase.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,13 @@ internal CSMOperationResult TrackOperation(Guid operationId, int checkFrequency
167167
{
168168
response = GetOperationStatus(operationId);
169169

170-
if (response.Status == CSMAzureBackupOperationStatus.Succeeded.ToString())
170+
if (response.Status != CSMAzureBackupOperationStatus.InProgress.ToString())
171171
{
172+
if(response.Status == CSMAzureBackupOperationStatus.Failed.ToString())
173+
{
174+
throw new Exception(string.Format("OperationStatus for operaiton id {0} is failed with error : {1}", operationId, response.Error.ToString()));
175+
}
176+
172177
break;
173178
}
174179

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Item/Enable-AzureBackupProtection .cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ public override void ExecuteCmdlet()
6262
}
6363
else
6464
{
65-
throw new Exception("Uknown item type");
65+
throw new Exception("Unknown item type");
6666
}
6767
}
6868

6969
else
7070
{
71-
throw new Exception("Uknown item type");
71+
throw new Exception("Unknown item type");
7272
}
7373

7474
var operationId = AzureBackupClient.EnableProtection(Item.ContainerUniqueName, itemName, input);

0 commit comments

Comments
 (0)