Don't retry when "no space left on device" in local backend

Also adds relevant documentation to the restic.Backend interface.
This commit is contained in:
greatroar
2020-12-16 13:58:02 +01:00
parent e96677cafb
commit f7784bddb3
4 changed files with 77 additions and 17 deletions

View File

@@ -3,6 +3,7 @@ package errors
import (
"net/url"
"github.com/cenkalti/backoff/v4"
"github.com/pkg/errors"
)
@@ -34,20 +35,19 @@ func Cause(err error) error {
}
for {
// unwrap *url.Error
if urlErr, ok := err.(*url.Error); ok {
err = urlErr.Err
continue
switch e := err.(type) {
case Causer: // github.com/pkg/errors
err = e.Cause()
case *backoff.PermanentError:
err = e.Err
case *url.Error:
err = e.Err
default:
return err
}
// if err is a Causer, return the cause for this error.
if c, ok := err.(Causer); ok {
err = c.Cause()
continue
}
break
}
return err
}
// Go 1.13-style error handling.
func Is(x, y error) bool { return errors.Is(x, y) }