Skip to content

Commit 51cdbea

Browse files
committed
Throwing an exception if JobID is not a string in GetJobDetails
1 parent aad117f commit 51cdbea

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Jobs/GetAzureRMBackupJobDetails.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@ public override void ExecuteCmdlet()
5050

5151
ExecutionBlock(() =>
5252
{
53+
if (JobID != null)
54+
{
55+
if ((JobID is PSObject) && (((PSObject)JobID).ImmediateBaseObject is string))
56+
{
57+
JobID = ((PSObject)JobID).ImmediateBaseObject.ToString();
58+
}
59+
else if (JobID is string)
60+
{
61+
// nothing to do
62+
}
63+
else
64+
{
65+
throw new Exception("JobID should be of the type string. Please input a string.");
66+
}
67+
}
5368
if (Job != null)
5469
{
5570
JobID = Job.InstanceId;

0 commit comments

Comments
 (0)