mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-05-24 12:07:13 -04:00
Add logging for context issue debugging
This commit is contained in:
parent
65a13a7b17
commit
2d39287df3
1 changed files with 2 additions and 2 deletions
|
@ -43,7 +43,7 @@ type ProgressReporter interface {
|
|||
|
||||
func downloadFileWithSemaphore(ctx context.Context, progressReporter ProgressReporter, client *http.Client, downloadURL, dstPath string, doRetries bool, sem *semaphore.Weighted) error {
|
||||
if err := sem.Acquire(ctx, 1); err != nil {
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
defer sem.Release(1)
|
||||
|
||||
|
@ -72,7 +72,6 @@ func downloadFileWithSemaphore(ctx context.Context, progressReporter ProgressRep
|
|||
time.Sleep(retryDelay)
|
||||
continue
|
||||
}
|
||||
fmt.Printf("download error after %d attempts, status code: %d, url: %s\n", attempt, resp.StatusCode, downloadURL)
|
||||
return fmt.Errorf("download error after %d attempts, status code: %d", attempt, resp.StatusCode)
|
||||
}
|
||||
|
||||
|
@ -95,6 +94,7 @@ func downloadFileWithSemaphore(ctx context.Context, progressReporter ProgressRep
|
|||
time.Sleep(retryDelay)
|
||||
continue
|
||||
}
|
||||
fmt.Printf("Error: %v, cause: %v\n", err, context.Cause(ctx))
|
||||
return err
|
||||
}
|
||||
file.Close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue