rest/sftp: Remove redundant fatal from error message

This caused restic to exit with error messages like
`Fatal: parsing repository location failed: Fatal: sftp path [...]`
`Fatal: create repository at rest:http://localhost:12345/ failed: Fatal: config file already exists`
This commit is contained in:
Michael Eischer 2023-05-13 22:19:19 +02:00
parent 2f518b7241
commit f9850b79b5
2 changed files with 3 additions and 3 deletions

View file

@ -62,7 +62,7 @@ func Create(ctx context.Context, cfg Config, rt http.RoundTripper) (*Backend, er
_, err = be.Stat(ctx, restic.Handle{Type: restic.ConfigFile}) _, err = be.Stat(ctx, restic.Handle{Type: restic.ConfigFile})
if err == nil { if err == nil {
return nil, errors.Fatal("config file already exists") return nil, errors.New("config file already exists")
} }
url := *cfg.URL url := *cfg.URL
@ -76,7 +76,7 @@ func Create(ctx context.Context, cfg Config, rt http.RoundTripper) (*Backend, er
} }
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
return nil, errors.Fatalf("server response unexpected: %v (%v)", resp.Status, resp.StatusCode) return nil, fmt.Errorf("server response unexpected: %v (%v)", resp.Status, resp.StatusCode)
} }
_, err = io.Copy(io.Discard, resp.Body) _, err = io.Copy(io.Discard, resp.Body)

View file

@ -80,7 +80,7 @@ func ParseConfig(s string) (interface{}, error) {
p := path.Clean(dir) p := path.Clean(dir)
if strings.HasPrefix(p, "~") { if strings.HasPrefix(p, "~") {
return nil, errors.Fatal("sftp path starts with the tilde (~) character, that fails for most sftp servers.\nUse a relative directory, most servers interpret this as relative to the user's home directory.") return nil, errors.New("sftp path starts with the tilde (~) character, that fails for most sftp servers.\nUse a relative directory, most servers interpret this as relative to the user's home directory")
} }
cfg := NewConfig() cfg := NewConfig()