mirror of
https://github.com/octoleo/restic.git
synced 2024-12-25 20:11:06 +00:00
07e5c38361
The only use cases in the code were in errors.IsFatal, backend/b2, which needs a workaround, and backend.ParseLayout. The last of these requires all backends to implement error unwrapping in IsNotExist. All backends except gs already did that.
38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
package errors
|
|
|
|
import (
|
|
stderrors "errors"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
// New creates a new error based on message. Wrapped so that this package does
|
|
// not appear in the stack trace.
|
|
var New = errors.New
|
|
|
|
// Errorf creates an error based on a format string and values. Wrapped so that
|
|
// this package does not appear in the stack trace.
|
|
var Errorf = errors.Errorf
|
|
|
|
// Wrap wraps an error retrieved from outside of restic. Wrapped so that this
|
|
// package does not appear in the stack trace.
|
|
var Wrap = errors.Wrap
|
|
|
|
// Wrapf returns an error annotating err with the format specifier. If err is
|
|
// nil, Wrapf returns nil.
|
|
var Wrapf = errors.Wrapf
|
|
|
|
// WithMessage annotates err with a new message. If err is nil, WithMessage
|
|
// returns nil.
|
|
var WithMessage = errors.WithMessage
|
|
|
|
var WithStack = errors.WithStack
|
|
|
|
// Go 1.13-style error handling.
|
|
|
|
func As(err error, tgt interface{}) bool { return stderrors.As(err, tgt) }
|
|
|
|
func Is(x, y error) bool { return stderrors.Is(x, y) }
|
|
|
|
func Unwrap(err error) error { return stderrors.Unwrap(err) }
|