Handle no configured accounts gracefully

Instead of throwing a runtime error, when no accounts are configured in
accounts.conf, we provide an informative error message.
This commit is contained in:
Julian P Samaroo 2019-03-30 15:23:14 -05:00 committed by Drew DeVault
parent 78db7ccafa
commit 45b4c8a724
1 changed files with 4 additions and 0 deletions

View File

@ -93,6 +93,10 @@ func loadAccountConfig(path string) ([]AccountConfig, error) {
}
accounts = append(accounts, account)
}
if len(accounts) == 0 {
err = errors.New("No accounts configured in accounts.conf")
return nil, err
}
return accounts, nil
}