From 091f3c611bca6f72d10c7d70d3f30e1dceb0a7b2 Mon Sep 17 00:00:00 2001 From: Joel Cooklin Date: Wed, 21 Oct 2015 22:32:21 -0700 Subject: [PATCH] Adds error handling and exit(1) if an invalid config is provided to pulsed --- pulse.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pulse.go b/pulse.go index d56e991af..4b42758d9 100644 --- a/pulse.go +++ b/pulse.go @@ -277,6 +277,15 @@ func action(ctx *cli.Context) { } cfg := control.NewConfig() err = json.Unmarshal(b, &cfg) + if err != nil { + log.WithFields(log.Fields{ + "block": "main", + "_module": "pulsed", + "error": err.Error(), + "path": config, + }).Fatal("invalid config") + os.Exit(1) + } controlOpts = append(controlOpts, control.OptSetConfig(cfg)) }