Skip to content

Commit

Permalink
🎨 Improve sync lock logging
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Nov 10, 2023
1 parent 3dccb4f commit 59dbd8b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sync_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package dejavu
import (
"errors"
"path/filepath"
"strings"
"time"

"github.com/88250/gulu"
Expand Down Expand Up @@ -152,6 +153,17 @@ func (repo *Repo) lockCloud0(currentDeviceID string) (err error) {
}

logging.LogErrorf("upload lock sync failed: %s", err)
msg := strings.ToLower(err.Error())
if strings.Contains(msg, "requesttimetooskewed") || strings.Contains(msg, "request time and the current time is too large") {
err = cloud.ErrSystemTimeIncorrect
return
}

if strings.Contains(msg, "unavailable") {
err = cloud.ErrCloudServiceUnavailable
return
}

err = ErrLockCloudFailed
}
return
Expand Down

0 comments on commit 59dbd8b

Please sign in to comment.