From 45b4c8a72474d38d0fcba342758b44d9238c76de Mon Sep 17 00:00:00 2001 From: Julian P Samaroo Date: Sat, 30 Mar 2019 15:23:14 -0500 Subject: 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. --- config/config.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'config') diff --git a/config/config.go b/config/config.go index 7aff1eaf..e5e332e7 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 } -- cgit