Skip to content

Commit 7cc4fae

Browse files
authored
fix(bucket): Implement error handling for failed bucket addition (#6051)
1 parent 83f25a4 commit 7cc4fae

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- **sqlite:** Fix compatibility with Windows PowerShell ([#6045](https://github.com/ScoopInstaller/Scoop/issues/6045))
66
- **install:** Expand `env_set` items before setting Environment Variables ([#6050](https://github.com/ScoopInstaller/Scoop/issues/6050))
7+
- **bucket:** Implement error handling for failed bucket addition ([#6051](https://github.com/ScoopInstaller/Scoop/issues/6051))
78

89
## [v0.5.0](https://github.com/ScoopInstaller/Scoop/compare/v0.4.2...v0.5.0) - 2024-07-01
910

lib/buckets.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,12 @@ function add_bucket($name, $repo) {
154154
}
155155
ensure $bucketsdir | Out-Null
156156
$dir = ensure $dir
157-
Invoke-Git -ArgumentList @('clone', $repo, $dir, '-q')
157+
$out = Invoke-Git -ArgumentList @('clone', $repo, $dir, '-q')
158+
if ($LASTEXITCODE -ne 0) {
159+
error "Failed to clone '$repo' to '$dir'.`n`nError given:`n$out`n`nPlease check the repository URL or network connection and try again."
160+
Remove-Item $dir -Recurse -Force -ErrorAction SilentlyContinue
161+
return 1
162+
}
158163
Write-Host 'OK'
159164
if (get_config USE_SQLITE_CACHE) {
160165
info 'Updating cache...'

0 commit comments

Comments
 (0)