Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(scoop-update): Properly summarize failed updates #177

Merged
merged 3 commits into from
Jul 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
adopt
  • Loading branch information
Ash258 committed Jul 16, 2021
commit aae801be544210b0a1eba7786b8ba49366c804bd
5 changes: 1 addition & 4 deletions bin/update-supporting.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,8 @@ foreach ($sup in $Sups) {
Invoke-ManifestScript -Manifest $manifest -ScriptName 'pre_install' -Architecture $architecture
} catch {
++$problems

$title, $body = $_.Exception.Message -split '\|-'
if (!$body) { $body = $title }
Write-UserMessage -Message $body -Err
debug $_.InvocationInfo
New-IssuePromptFromException -ExceptionMessage $_.Exception.Message

continue
}
Expand Down
6 changes: 6 additions & 0 deletions lib/Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,18 @@ function New-IssuePrompt {
}

function New-IssuePromptFromException {
<#
.SYNOPSIS
Wrapper for handling <Title>|-<Body> exception messages with support for promping user with according link to create a new issue.
#>
param(
[String] $ExceptionMessage,
[AllowNull()]
[String] $Application,
[AllowNull()]
[String] $Bucket
)

process {
$title, $body = $ExceptionMessage -split '\|-'
if (!$body) { $body = $title }
Expand Down
5 changes: 1 addition & 4 deletions libexec/scoop-cat.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ foreach ($app in $Applications) {
$resolved = Resolve-ManifestInformation -ApplicationQuery $app
} catch {
++$Problems

$title, $body = $_.Exception.Message -split '\|-'
if (!$body) { $body = $title }
Write-UserMessage -Message $body -Err
debug $_.InvocationInfo
New-IssuePromptFromException -ExceptionMessage $_.Exception.Message

continue
}
Expand Down
15 changes: 3 additions & 12 deletions libexec/scoop-download.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,8 @@ foreach ($app in $application) {
$resolved = Resolve-ManifestInformation -ApplicationQuery $app
} catch {
++$problems

$title, $body = $_.Exception.Message -split '\|-'
if (!$body) { $body = $title }
Write-UserMessage -Message $body -Err
debug $_.InvocationInfo
New-IssuePromptFromException -ExceptionMessage $_.Exception.Message

continue
}
Expand Down Expand Up @@ -77,11 +74,8 @@ foreach ($app in $application) {
++$problems
}

$title, $body = $_.Exception.Message -split '\|-'
if (!$body) { $body = $title }
Write-UserMessage -Message $body -Err
debug $_.InvocationInfo
if ($title -ne 'Ignore' -and ($title -ne $body)) { New-IssuePrompt -Application $appName -Bucket $bucket -Title $title -Body $body }
New-IssuePromptFromException -ExceptionMessage $_.Exception.Message -Application $appName -Bucket $bucket

continue
}
Expand Down Expand Up @@ -115,11 +109,8 @@ foreach ($app in $application) {
++$problems
}

$title, $body = $_.Exception.Message -split '\|-'
if (!$body) { $body = $title }
Write-UserMessage -Message $body -Err
debug $_.InvocationInfo
if ($title -ne 'Ignore' -and ($title -ne $body)) { New-IssuePrompt -Application $appName -Bucket $bucket -Title $title -Body $body }
New-IssuePromptFromException -ExceptionMessage $_.Exception.Message -Application $appName -Bucket $bucket

continue
}
Expand Down
4 changes: 1 addition & 3 deletions libexec/scoop-home.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ $resolved = $null
try {
$resolved = Resolve-ManifestInformation -ApplicationQuery $Application
} catch {
$title, $body = $_.Exception.Message -split '\|-'
if (!$body) { $body = $title }
Write-UserMessage -Message $body -Err
debug $_.InvocationInfo
New-IssuePromptFromException -ExceptionMessage $_.Exception.Message

$ExitCode = 3
}
Expand Down
12 changes: 3 additions & 9 deletions libexec/scoop-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ if (!$independent) {
try {
$apps = install_order $apps $architecture # Add dependencies
} catch {
$title, $body = $_.Exception.Message -split '\|-'
Write-UserMessage -Message $body -Err
if ($title -ne 'Ignore') {
New-IssuePrompt -Application $app -Title $title -Body $body
}
New-IssuePromptFromException -ExceptionMessage $_.Exception.Message
}
}

Expand Down Expand Up @@ -156,6 +152,7 @@ foreach ($app in $apps) {
continue
}

# TODO: Resolve-ManifestInformation
$cleanApp, $bucket = parse_app $app

# Prevent checking of already installed applications if specific version was provided.
Expand All @@ -178,11 +175,8 @@ foreach ($app in $apps) {
# Register failed dependencies
if ($explicit_apps -notcontains $app) { $failedDependencies += $app } else { $failedApplications += $app }

$title, $body = $_.Exception.Message -split '\|-'
if (!$body) { $body = $title }
Write-UserMessage -Message $body -Err
debug $_.InvocationInfo
if ($title -ne 'Ignore' -and ($title -ne $body)) { New-IssuePrompt -Application $cleanApp -Bucket $bucket -Title $title -Body $body }
New-IssuePromptFromException -ExceptionMessage $_.Exception.Message -Application $cleanApp -Bucket $bucket

continue
}
Expand Down
6 changes: 1 addition & 5 deletions libexec/scoop-uninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,8 @@ foreach ($explode in $Applications) {
$result = Uninstall-ScoopApplication -App $app -Global:$gl -Purge:$Purge -Older
} catch {
++$Problems

$title, $body = $_.Exception.Message -split '\|-'
if (!$body) { $body = $title }
Write-UserMessage -Message $body -Err
debug $_.InvocationInfo
if ($title -ne 'Ignore' -and ($title -ne $body)) { New-IssuePrompt -Application $app -Bucket $bucket -Title $title -Body $body }
New-IssuePromptFromException -ExceptionMessage $_.Exception.Message -Application $app -Bucket $bucket

continue
}
Expand Down