Refactor error handling in prompt mode; add cred flag and reset func

This commit is contained in:
Mitchell Simon 2019-08-31 17:19:25 -04:00
parent 84ea1cacdf
commit 633945b1d1
8 changed files with 72 additions and 33 deletions

View file

@ -71,6 +71,7 @@ func (mgr *ConfigManager) OpenConfig() (output string, v *viper.Viper, err error
if err == errConfigDecrypted {
configDecrypted = true
} else if err != nil && err.Error() == crypto.ErrAuthenticationFailed.Error() {
mgr.masterpass = ""
return output, nil, errors.New("incorrect masterpass")
} else if err != nil {
return output, nil, err