Skip to content

Commit 0f5eae4

Browse files
committed
Error handling
1 parent 7bf7ebb commit 0f5eae4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/RegisterAzureBackupContainer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public override void ExecuteCmdlet()
9595
//Container is not discovered. Throw exception
9696
string errMsg = String.Format("Failed to discover VM {0} under {1} {2}. Please make sure names are correct and VM is not deleted", vmName, ServiceOrRG, rgName);
9797
WriteDebug(errMsg);
98-
WriteError(new ErrorRecord(new Exception(Resources.AzureVMNotFound), string.Empty, ErrorCategory.InvalidArgument, null));
98+
ThrowTerminatingError(new ErrorRecord(new Exception(Resources.AzureVMNotFound), string.Empty, ErrorCategory.InvalidArgument, null));
9999
}
100100
}
101101

@@ -128,7 +128,7 @@ private void RefreshContainer()
128128

129129
if (!isDiscoverySuccessful)
130130
{
131-
WriteError(new ErrorRecord(new Exception(errorMessage), string.Empty, ErrorCategory.InvalidArgument, null));
131+
ThrowTerminatingError(new ErrorRecord(new Exception(errorMessage), string.Empty, ErrorCategory.InvalidArgument, null));
132132
}
133133
}
134134

0 commit comments

Comments
 (0)