mirror of
https://github.com/restic/restic.git
synced 2024-12-22 07:43:03 +00:00
archiver: Make sure backend error is passed up
This commit is contained in:
parent
c5e75d1c98
commit
e43c9202a6
1 changed files with 3 additions and 1 deletions
|
@ -218,6 +218,7 @@ func (arch *Archiver) SaveDir(ctx context.Context, snPath string, fi os.FileInfo
|
|||
for _, name := range names {
|
||||
// test if context has been cancelled
|
||||
if ctx.Err() != nil {
|
||||
debug.Log("context has been cancelled, aborting")
|
||||
return FutureTree{}, ctx.Err()
|
||||
}
|
||||
|
||||
|
@ -767,7 +768,8 @@ func (arch *Archiver) Snapshot(ctx context.Context, targets []string, opts Snaps
|
|||
|
||||
t.Kill(nil)
|
||||
werr := t.Wait()
|
||||
if err != nil && errors.Cause(err) == context.Canceled {
|
||||
debug.Log("err is %v, werr is %v", err, werr)
|
||||
if err == nil || errors.Cause(err) == context.Canceled {
|
||||
err = werr
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue