Skip to content

Commit

Permalink
Simplify log output to be more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
Yrp committed Oct 22, 2021
1 parent 33f24b2 commit 707a587
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion spin/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package spin

import (
"context"
"strings"
"time"
)

Expand All @@ -14,7 +15,15 @@ func periodicSync(period, timeout time.Duration, msg string, syncFunc func(conte
defer cancel()
err := syncFunc(ctx)
if err != nil {
log.Errorf("Failed to sync %s: %s", msg, err)
if strings.Contains(err.Error(), "Cannot query to get stats, please wait for host validation") {
log.Errorf("Currently syncing the BTFS network, " +
"which may last several hours depending on network conditions. Please be patient.")
} else if strings.Contains(err.Error(), "Cannot query to get hosts") {
log.Errorf("Cannot query to get hosts. " +
"If you are not a renter, i.e. don't need to upload files, you can ignore it.")
} else {
log.Errorf("Failed to sync %s: %s", msg, err)
}
}
}
}

0 comments on commit 707a587

Please sign in to comment.