Skip to content

Commit 350a7cc

Browse files
committed
fix(checkver): Correct error messages
1 parent 3a39ba0 commit 350a7cc

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

bin/checkver.ps1

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,11 @@ while ($in_progress -gt 0) {
285285
continue
286286
}
287287

288-
if ($url) {
288+
if ($script) {
289+
$source = 'the output of script'
290+
$page = Invoke-Command ([scriptblock]::Create($script -join "`r`n"))
291+
} elseif ($url) {
292+
$source = $url
289293
$ms = New-Object System.IO.MemoryStream
290294
$ms.Write($result, 0, $result.Length)
291295
$ms.Seek(0, 0) | Out-Null
@@ -294,9 +298,6 @@ while ($in_progress -gt 0) {
294298
}
295299
$page = (New-Object System.IO.StreamReader($ms, (Get-Encoding $wc))).ReadToEnd()
296300
}
297-
if ($script) {
298-
$page = Invoke-Command ([scriptblock]::Create($script -join "`r`n"))
299-
}
300301

301302
if ($jsonpath) {
302303
# Return only a single value if regex is absent
@@ -310,7 +311,7 @@ while ($in_progress -gt 0) {
310311
$ver = json_path_legacy $page $jsonpath
311312
}
312313
if (!$ver) {
313-
next "couldn't find '$jsonpath' in $url"
314+
next "couldn't find '$jsonpath' in $source"
314315
continue
315316
}
316317
}
@@ -332,7 +333,7 @@ while ($in_progress -gt 0) {
332333
# Getting version from XML, using XPath
333334
$ver = $xml.SelectSingleNode($xpath, $nsmgr).'#text'
334335
if (!$ver) {
335-
next "couldn't find '$($xpath -replace 'ns:', '')' in $url"
336+
next "couldn't find '$($xpath -replace 'ns:', '')' in $source"
336337
continue
337338
}
338339
}
@@ -366,13 +367,13 @@ while ($in_progress -gt 0) {
366367
$ver = $matchesHashtable['version']
367368
}
368369
} else {
369-
next "couldn't match '$regexp' in $url"
370+
next "couldn't match '$regexp' in $source"
370371
continue
371372
}
372373
}
373374

374375
if (!$ver) {
375-
next "couldn't find new version in $url"
376+
next "couldn't find new version in $source"
376377
continue
377378
}
378379
}

0 commit comments

Comments
 (0)