From 893bc9f777ce44bffc95041624c06bfdac6154b0 Mon Sep 17 00:00:00 2001 From: donat Date: Thu, 27 Jul 2017 14:23:08 +0300 Subject: [PATCH] Error message in case PasswordFile is missing --- cmd/restic/global.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/restic/global.go b/cmd/restic/global.go index 673d8bcaf..874a26408 100644 --- a/cmd/restic/global.go +++ b/cmd/restic/global.go @@ -206,6 +206,9 @@ func Exitf(exitcode int, format string, args ...interface{}) { func resolvePassword(opts GlobalOptions, env string) (string, error) { if opts.PasswordFile != "" { s, err := ioutil.ReadFile(opts.PasswordFile) + if os.IsNotExist(err) { + return "", errors.Fatalf("%s does not exist", opts.PasswordFile) + } return strings.TrimSpace(string(s)), errors.Wrap(err, "Readfile") }