Show progress bars as aborted on export / import error

This commit is contained in:
Philipp Wolfer 2025-05-04 12:59:40 +02:00
parent 15d939e150
commit aae5123c3d
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
12 changed files with 35 additions and 21 deletions

View file

@ -106,7 +106,7 @@ func (b *SpotifyApiBackend) ExportListens(oldestTimestamp time.Time, results cha
for {
result, err := b.client.RecentlyPlayedAfter(minTime, MaxItemsPerGet)
if err != nil {
progress <- p.Complete()
progress <- p.Abort()
results <- models.ListensResult{Error: err}
return
}
@ -118,7 +118,7 @@ func (b *SpotifyApiBackend) ExportListens(oldestTimestamp time.Time, results cha
// Set minTime to the newest returned listen
after, err := strconv.ParseInt(result.Cursors.After, 10, 64)
if err != nil {
progress <- p.Complete()
progress <- p.Abort()
results <- models.ListensResult{Error: err}
return
} else if after <= minTime.Unix() {
@ -169,7 +169,7 @@ out:
for {
result, err := b.client.UserTracks(offset, perPage)
if err != nil {
progress <- p.Complete()
progress <- p.Abort()
results <- models.LovesResult{Error: err}
return
}