diff options
author | Julian P Samaroo <jpsamaroo@jpsamaroo.me> | 2019-03-30 15:23:14 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-30 16:26:55 -0400 |
commit | 45b4c8a72474d38d0fcba342758b44d9238c76de (patch) | |
tree | 7d6045554491a48ea2c1221c03e4c5ac1f186c78 | |
parent | 78db7ccafaeb971871ddf60511a50143491ca1d2 (diff) |
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.
-rw-r--r-- | config/config.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/config/config.go b/config/config.go index 7aff1ea..e5e332e 100644 --- a/config/config.go +++ b/config/config.go @@ -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 } |