Skip to content

Commit 3339303

Browse files
author
Patrick Pichler
committed
Add error handling to pass password-source
1 parent 3c0a62e commit 3339303

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

jiracli/password.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ func (o *GlobalOptions) GetPass() string {
8282
cmd.Stderr = buf
8383
if err := cmd.Run(); err == nil {
8484
passwd = strings.TrimSpace(buf.String())
85+
} else {
86+
panic(err)
8587
}
88+
} else {
89+
log.Warning("Pass binary was not found! Fallback to default password behaviour!")
8690
}
8791
} else if o.PasswordSource.Value == "stdin" {
8892
allBytes, err := ioutil.ReadAll(os.Stdin)
@@ -188,6 +192,8 @@ func (o *GlobalOptions) SetPass(passwd string) error {
188192
return fmt.Errorf("Failed to clear password for %s", passName)
189193
}
190194
}
195+
} else {
196+
return fmt.Errorf("Pass binary not found!")
191197
}
192198
} else if o.PasswordSource.Value != "" {
193199
return fmt.Errorf("Unknown password-source: %s", o.PasswordSource)

0 commit comments

Comments
 (0)