fix: better error for no data from snapshots (#22452)

Closes: #16739
pull/22522/head
Sam Arnold 2021-09-16 09:34:31 -04:00 committed by GitHub
parent 24f9f05264
commit 84b785b78c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -541,9 +541,15 @@ func (cmd *Command) download(req *snapshotter.Request, path string) error {
}
// Read snapshot from the connection
if n, err := io.Copy(f, conn); err != nil || n == 0 {
n, err := io.Copy(f, conn)
if err != nil {
return fmt.Errorf("copy backup to file: err=%v, n=%d", err, n)
}
if n == 0 {
// Unfortunately there is no out-of-band channel to actually return errors from the snapshot service, just
// 'data' or 'no data'.
return fmt.Errorf("copy backup to file: no data returned, check server logs for snapshot errors")
}
return nil
}(); err == nil {
break