Skip to content

Commit

Permalink
Handle errors gracefully in keyring
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Nov 30, 2018
1 parent 377d68e commit e612476
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/keyring.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"
"github.com/twpayne/chezmoi/lib/chezmoi"
"github.com/zalando/go-keyring"
)

Expand Down Expand Up @@ -35,7 +38,7 @@ func init() {
func (*Config) keyringFunc(service, user string) string {
password, err := keyring.Get(service, user)
if err != nil {
return err.Error()
chezmoi.ReturnTemplateFuncError(fmt.Errorf("keyring %q %q: %v", service, user, err))
}
return password
}

0 comments on commit e612476

Please sign in to comment.