Skip to content

Commit

Permalink
fix(checkver): Correct error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis-yeung committed Jun 21, 2024
1 parent 3a39ba0 commit 350a7cc
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions bin/checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,11 @@ while ($in_progress -gt 0) {
continue
}

if ($url) {
if ($script) {
$source = 'the output of script'
$page = Invoke-Command ([scriptblock]::Create($script -join "`r`n"))
} elseif ($url) {
$source = $url
$ms = New-Object System.IO.MemoryStream
$ms.Write($result, 0, $result.Length)
$ms.Seek(0, 0) | Out-Null
Expand All @@ -294,9 +298,6 @@ while ($in_progress -gt 0) {
}
$page = (New-Object System.IO.StreamReader($ms, (Get-Encoding $wc))).ReadToEnd()
}
if ($script) {
$page = Invoke-Command ([scriptblock]::Create($script -join "`r`n"))
}

if ($jsonpath) {
# Return only a single value if regex is absent
Expand All @@ -310,7 +311,7 @@ while ($in_progress -gt 0) {
$ver = json_path_legacy $page $jsonpath
}
if (!$ver) {
next "couldn't find '$jsonpath' in $url"
next "couldn't find '$jsonpath' in $source"
continue
}
}
Expand All @@ -332,7 +333,7 @@ while ($in_progress -gt 0) {
# Getting version from XML, using XPath
$ver = $xml.SelectSingleNode($xpath, $nsmgr).'#text'
if (!$ver) {
next "couldn't find '$($xpath -replace 'ns:', '')' in $url"
next "couldn't find '$($xpath -replace 'ns:', '')' in $source"
continue
}
}
Expand Down Expand Up @@ -366,13 +367,13 @@ while ($in_progress -gt 0) {
$ver = $matchesHashtable['version']
}
} else {
next "couldn't match '$regexp' in $url"
next "couldn't match '$regexp' in $source"
continue
}
}

if (!$ver) {
next "couldn't find new version in $url"
next "couldn't find new version in $source"
continue
}
}
Expand Down

0 comments on commit 350a7cc

Please sign in to comment.