From d8b3cc8a6cd88fa46995160deb6fd5f888cb27d8 Mon Sep 17 00:00:00 2001 From: "L. Yeung" Date: Tue, 25 Jun 2024 10:40:56 +0800 Subject: [PATCH] fix(checkver): Correct error messages (#6024) --- CHANGELOG.md | 1 + bin/checkver.ps1 | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 303d3614d6..6c71431a8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - **core:** Search for Git executable instead of any cmdlet ([#5998](https://github.com/ScoopInstaller/Scoop/issues/5998)) - **core:** Use correct path in 'bash' ([#6006](https://github.com/ScoopInstaller/Scoop/issues/6006)) - **core:** Limit the number of commands to get when search for git executable ([#6013](https://github.com/ScoopInstaller/Scoop/pull/6013)) +- **checkver:** Correct error messages ([#6024](https://github.com/ScoopInstaller/Scoop/issues/6024)) ### Code Refactoring diff --git a/bin/checkver.ps1 b/bin/checkver.ps1 index 48691c872c..57010c9992 100644 --- a/bin/checkver.ps1 +++ b/bin/checkver.ps1 @@ -294,8 +294,10 @@ while ($in_progress -gt 0) { } $page = (New-Object System.IO.StreamReader($ms, (Get-Encoding $wc))).ReadToEnd() } + $source = $url if ($script) { $page = Invoke-Command ([scriptblock]::Create($script -join "`r`n")) + $source = 'the output of script' } if ($jsonpath) { @@ -310,7 +312,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 } } @@ -332,7 +334,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 } } @@ -366,13 +368,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 } }