Create package restic/errors

This commit is contained in:
Alexander Neumann
2016-09-03 21:10:24 +02:00
parent 765b5437bd
commit bc42dbdf87
75 changed files with 140 additions and 102 deletions
+6 -5
View File
@@ -17,8 +17,9 @@ import (
"restic/location"
"restic/repository"
"restic/errors"
"github.com/jessevdk/go-flags"
"github.com/pkg/errors"
"golang.org/x/crypto/ssh/terminal"
)
@@ -246,7 +247,7 @@ const maxKeys = 20
// OpenRepository reads the password and opens the repository.
func (o GlobalOptions) OpenRepository() (*repository.Repository, error) {
if o.Repo == "" {
return nil, restic.Fatal("Please specify repository location (-r)")
return nil, errors.Fatal("Please specify repository location (-r)")
}
be, err := open(o.Repo)
@@ -262,7 +263,7 @@ func (o GlobalOptions) OpenRepository() (*repository.Repository, error) {
err = s.SearchKey(o.password, maxKeys)
if err != nil {
return nil, restic.Fatalf("unable to open repo: %v", err)
return nil, errors.Fatalf("unable to open repo: %v", err)
}
return s, nil
@@ -300,7 +301,7 @@ func open(s string) (restic.Backend, error) {
}
debug.Log("open", "invalid repository location: %v", s)
return nil, restic.Fatalf("invalid scheme %q", loc.Scheme)
return nil, errors.Fatalf("invalid scheme %q", loc.Scheme)
}
// Create the backend specified by URI.
@@ -335,5 +336,5 @@ func create(s string) (restic.Backend, error) {
}
debug.Log("open", "invalid repository scheme: %v", s)
return nil, restic.Fatalf("invalid scheme %q", loc.Scheme)
return nil, errors.Fatalf("invalid scheme %q", loc.Scheme)
}