diff --git a/CHANGELOG.md b/CHANGELOG.md index fab1fbefbd..3d8ef677ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ ### Builds - **checkver,auto-pr:** Allow passing file path ([#5019](https://github.com/ScoopInstaller/Scoop/issues/5019)) +- **checkver:** Exit routine earlier if error ([#5025](https://github.com/ScoopInstaller/Scoop/issues/5025)) ### Tests diff --git a/bin/checkver.ps1 b/bin/checkver.ps1 index 055a90636c..1b2fb2033e 100644 --- a/bin/checkver.ps1 +++ b/bin/checkver.ps1 @@ -224,20 +224,20 @@ while ($in_progress -gt 0) { $ver = $Version if (!$ver) { - $page = (Get-Encoding($wc)).GetString($ev.SourceEventArgs.Result) - $err = $ev.SourceEventArgs.Error - if ($json.checkver.script) { - $page = Invoke-Command ([scriptblock]::Create($json.checkver.script -join "`r`n")) + if (!$regex -and $replace) { + next "'replace' requires 're' or 'regex'" + continue } - + $err = $ev.SourceEventArgs.Error if ($err) { next "$($err.message)`r`nURL $url is not valid" continue } - if (!$regex -and $replace) { - next "'replace' requires 're' or 'regex'" - continue + if ($json.checkver.script) { + $page = Invoke-Command ([scriptblock]::Create($json.checkver.script -join "`r`n")) + } else { + $page = (Get-Encoding($wc)).GetString($ev.SourceEventArgs.Result) } if ($jsonpath) {