forked from TrueCloudLab/rclone
b2: Treat 403 errors (eg cap exceeded) as fatal #420
This commit is contained in:
parent
13591c7c00
commit
606961f49d
1 changed files with 11 additions and 0 deletions
|
@ -4,6 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/ncw/rclone/fs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Error describes a B2 error response
|
// Error describes a B2 error response
|
||||||
|
@ -18,6 +20,15 @@ func (e *Error) Error() string {
|
||||||
return fmt.Sprintf("%s (%d %s)", e.Message, e.Status, e.Code)
|
return fmt.Sprintf("%s (%d %s)", e.Message, e.Status, e.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fatal statisfies the Fatal interface
|
||||||
|
//
|
||||||
|
// It indicates which errors should be treated as fatal
|
||||||
|
func (e *Error) Fatal() bool {
|
||||||
|
return e.Status == 403 // 403 errors shouldn't be retried
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ fs.Fataler = (*Error)(nil)
|
||||||
|
|
||||||
// Account describes a B2 account
|
// Account describes a B2 account
|
||||||
type Account struct {
|
type Account struct {
|
||||||
ID string `json:"accountId"` // The identifier for the account.
|
ID string `json:"accountId"` // The identifier for the account.
|
||||||
|
|
Loading…
Reference in a new issue