aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2023-04-22 22:36:44 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2023-04-22 22:36:44 +0200
commitd743fd7310b767ad26fc0c13353efa94dadc8f62 (patch)
tree93a180306201d238ebfc3dd04cf024a0b4e6847a
parent88c803335f1d251083a6b505814f90a07a621318 (diff)
downloadfeed2imap-go-d743fd7310b767ad26fc0c13353efa94dadc8f62.tar.gz
feed2imap-go-d743fd7310b767ad26fc0c13353efa94dadc8f62.tar.bz2
feed2imap-go-d743fd7310b767ad26fc0c13353efa94dadc8f62.zip
Improve error handling
Diffstat (limited to '')
-rw-r--r--pkg/config/yaml.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/pkg/config/yaml.go b/pkg/config/yaml.go
index 3050825..3134f84 100644
--- a/pkg/config/yaml.go
+++ b/pkg/config/yaml.go
@@ -119,7 +119,7 @@ func (cfg *Config) parse(in io.Reader) error {
cfg.fixGlobalOptions(parsedCfg.GlobalConfig)
if err := buildFeeds(parsedCfg.Feeds, []string{}, cfg.Feeds, &cfg.FeedOptions, cfg.AutoTarget, &cfg.Target); err != nil {
- return fmt.Errorf("while parsing: %w", err)
+ return err
}
return nil
@@ -200,6 +200,12 @@ func buildFeeds(cfg []configGroupFeed, target []string, feeds Feeds,
if _, ok := feeds[name]; ok {
return fmt.Errorf("Duplicate Feed Name '%s'", name)
}
+ if len(f.Group.Feeds) > 0 {
+ return fmt.Errorf("Feed '%s' tries to also be a group.", name)
+ }
+ if f.Feed.Url == "" && len(f.Feed.Exec) == 0 {
+ return fmt.Errorf("Feed '%s' has not specified a URL or an Exec clause.", name)
+ }
opt, unknown := buildOptions(globalFeedOptions, f.Options)
@@ -218,6 +224,10 @@ func buildFeeds(cfg []configGroupFeed, target []string, feeds Feeds,
}
case f.isGroup():
+ if len(f.Group.Feeds) == 0 {
+ log.Warnf("Group '%s' does not contain any feeds.", f.Group.Group)
+ }
+
opt, unknown := buildOptions(globalFeedOptions, f.Options)
for _, optName := range unknown {