From ad003274d2529bfa21989f5b701ae2a3abd1b3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zlatko=20=C4=8Calu=C5=A1i=C4=87?= Date: Sun, 6 Nov 2016 20:18:07 +0100 Subject: [PATCH] Remove unused errors package --- errors/doc.go | 2 -- errors/fatal.go | 35 ----------------------------------- errors/wrap.go | 19 ------------------- 3 files changed, 56 deletions(-) delete mode 100644 errors/doc.go delete mode 100644 errors/fatal.go delete mode 100644 errors/wrap.go diff --git a/errors/doc.go b/errors/doc.go deleted file mode 100644 index 9f63cf9..0000000 --- a/errors/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package errors provides custom error types used within restic. -package errors diff --git a/errors/fatal.go b/errors/fatal.go deleted file mode 100644 index 2ac03e2..0000000 --- a/errors/fatal.go +++ /dev/null @@ -1,35 +0,0 @@ -package errors - -import "fmt" - -// fatalError is an error that should be printed to the user, then the program should exit with an error code. -type fatalError string - -func (e fatalError) Error() string { - return string(e) -} - -func (e fatalError) Fatal() bool { - return true -} - -// Fataler is an error which should be printed to the user directly. Afterwards, the program should exit with an error. -type Fataler interface { - Fatal() bool -} - -// IsFatal returns true if err is a fatal message that should be printed to the user. Then, the program should exit. -func IsFatal(err error) bool { - e, ok := err.(Fataler) - return ok && e.Fatal() -} - -// Fatal returns a wrapped error which implements the Fataler interface. -func Fatal(s string) error { - return Wrap(fatalError(s), "Fatal") -} - -// Fatalf returns an error which implements the Fataler interface. -func Fatalf(s string, data ...interface{}) error { - return fatalError(fmt.Sprintf(s, data...)) -} diff --git a/errors/wrap.go b/errors/wrap.go deleted file mode 100644 index 97d7666..0000000 --- a/errors/wrap.go +++ /dev/null @@ -1,19 +0,0 @@ -package errors - -import "github.com/pkg/errors" - -// Cause returns the cause of an error. -func Cause(err error) error { - return errors.Cause(err) -} - -// 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