mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 14:56:29 +00:00
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:
parent
2f518b7241
commit
f9850b79b5
@ -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)
|
||||||
|
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user