Skip to content

Commit 189a2fe

Browse files
author
anshii03
authored
Update CltTasksUtility.ps1 for QuickPerfTest Task (#14733)
* Update CltTasksUtility.ps1 * Update task.loc.json * Update task.json
1 parent dfe87e6 commit 189a2fe

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

Tasks/QuickPerfTestV1/CltTasksUtility.ps1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
function InvokeRestMethod($headers, $contentType, $uri , $method= "Get", $body)
22
{
33
$ServicePoint = [System.Net.ServicePointManager]::FindServicePoint($uri)
4-
$result = Invoke-RestMethod -ContentType "application/json" -UserAgent $global:userAgent -TimeoutSec $global:RestTimeout -Uri $uri -Method $method -Headers $headers -Body $body
4+
try
5+
{
6+
$result = Invoke-RestMethod -ContentType "application/json" -UserAgent $global:userAgent -TimeoutSec $restTimeout -Uri $uri -Method $method -Headers $headers -Body $body
7+
}
8+
catch
9+
{
10+
Write-Host "An error occurred:"
11+
$errorObject = ConvertFrom-Json -InputObject $_.ErrorDetails
12+
$errorMessage = $errorObject.message
13+
Write-Error $errorMessage
14+
throw "Error occurred while calling API: $method $uri. Please check error messages for more details."
15+
}
516
$ServicePoint.CloseConnectionGroup("")
617
return $result
718
}

Tasks/QuickPerfTestV1/task.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 1,
16-
"Minor": 0,
17-
"Patch": 41
16+
"Minor": 186,
17+
"Patch": 0
1818
},
1919
"deprecated": true,
2020
"demands": [
@@ -157,4 +157,4 @@
157157
"workingDirectory": "$(currentDirectory)"
158158
}
159159
}
160-
}
160+
}

Tasks/QuickPerfTestV1/task.loc.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 1,
16-
"Minor": 0,
17-
"Patch": 41
16+
"Minor": 186,
17+
"Patch": 0
1818
},
1919
"deprecated": true,
2020
"demands": [
@@ -157,4 +157,4 @@
157157
"workingDirectory": "$(currentDirectory)"
158158
}
159159
}
160-
}
160+
}

0 commit comments

Comments
 (0)