mirror of
https://github.com/restic/restic.git
synced 2026-09-28 15:00:30 +00:00
Create package restic/errors
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user