summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJulian P Samaroo <jpsamaroo@jpsamaroo.me>2019-03-30 15:23:14 -0500
committerDrew DeVault <sir@cmpwn.com>2019-03-30 16:26:55 -0400
commit45b4c8a72474d38d0fcba342758b44d9238c76de (patch)
tree7d6045554491a48ea2c1221c03e4c5ac1f186c78
parent78db7ccafaeb971871ddf60511a50143491ca1d2 (diff)
downloadaerc-45b4c8a72474d38d0fcba342758b44d9238c76de.tar.gz
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.go4
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
 }
 
href='#n123'>123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143