Mercurial > go > multipass
diff multipass-add.go @ 7:406d3cd76739
Report errors to the user.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sat, 24 Oct 2015 23:40:13 -0400 |
parents | a4fa4f28b472 |
children | 1246b4b9028b |
line wrap: on
line diff
--- a/multipass-add.go Sat Oct 24 23:33:16 2015 -0400 +++ b/multipass-add.go Sat Oct 24 23:40:13 2015 -0400 @@ -18,14 +18,19 @@ text, err := reader.ReadString('\n') if err != nil { fmt.Println(err.Error()) - return + os.Exit(1) } text = text[:len(text)-1] entry, password, err := auth.NewEntry(text) if err != nil { fmt.Println(err.Error()) - return + os.Exit(1) } - passfile.Add(entry) + err = passfile.Add(entry) + if err != nil { + fmt.Println("Couldn't create a password:") + fmt.Println(err.Error()) + os.Exit(1) + } fmt.Printf("New password: %s\n", password) }