forked from TrueCloudLab/rclone
onedrive: fix error handling broken by removal of github.com/pkg/errors
There were instances of errors.Wrap being called with a nil error which the conversion didn't deal with correctly.
This commit is contained in:
parent
96e099d8e7
commit
21ba4d9a18
1 changed files with 8 additions and 2 deletions
|
@ -827,9 +827,12 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
|
|
||||||
// Get rootID
|
// Get rootID
|
||||||
rootInfo, _, err := f.readMetaDataForPath(ctx, "")
|
rootInfo, _, err := f.readMetaDataForPath(ctx, "")
|
||||||
if err != nil || rootInfo.GetID() == "" {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to get root: %w", err)
|
return nil, fmt.Errorf("failed to get root: %w", err)
|
||||||
}
|
}
|
||||||
|
if rootInfo.GetID() == "" {
|
||||||
|
return nil, errors.New("failed to get root: ID was empty")
|
||||||
|
}
|
||||||
|
|
||||||
f.dirCache = dircache.New(root, rootInfo.GetID(), f)
|
f.dirCache = dircache.New(root, rootInfo.GetID(), f)
|
||||||
|
|
||||||
|
@ -1188,8 +1191,11 @@ func (f *Fs) waitForJob(ctx context.Context, location string, o *Object) error {
|
||||||
return fmt.Errorf("%s: async operation returned %q", o.remote, status.Status)
|
return fmt.Errorf("%s: async operation returned %q", o.remote, status.Status)
|
||||||
case "completed":
|
case "completed":
|
||||||
err = o.readMetaData(ctx)
|
err = o.readMetaData(ctx)
|
||||||
|
if err != nil {
|
||||||
return fmt.Errorf("async operation completed but readMetaData failed: %w", err)
|
return fmt.Errorf("async operation completed but readMetaData failed: %w", err)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue