From 2776b864b487ea9a989868423ba41a85afbadb68 Mon Sep 17 00:00:00 2001 From: Miguel Duarte Barroso Date: Wed, 20 Dec 2023 16:41:12 +0100 Subject: [PATCH] reconciler: sort out the reconciler error codes Signed-off-by: Miguel Duarte Barroso --- cmd/controlloop/controlloop.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cmd/controlloop/controlloop.go b/cmd/controlloop/controlloop.go index e0491304b..17bca211b 100644 --- a/cmd/controlloop/controlloop.go +++ b/cmd/controlloop/controlloop.go @@ -36,10 +36,13 @@ const ( ) const ( - couldNotCreateController = 1 - couldNotReadFlatfile = 1 - couldNotGetFlatIPAM = 1 - cronExpressionError = 1 + _ int = iota + couldNotCreateController + couldNotGetFlatIPAM + cronExpressionError + cronSchedulerCreationError + fileWatcherError + fileWatcherAddWatcherError ) const ( @@ -70,7 +73,7 @@ func main() { s, err := gocron.NewScheduler(gocron.WithLocation(time.UTC)) if err != nil { - os.Exit(123) + os.Exit(cronSchedulerCreationError) } schedule := determineCronExpression() @@ -91,14 +94,14 @@ func main() { watcher, err := fsnotify.NewWatcher() if err != nil { _ = logging.Errorf("error creating configuration watcher: %v", err) - os.Exit(321) + os.Exit(fileWatcherError) } defer watcher.Close() go syncConfiguration(watcher, s, job, errorChan) if err := watcher.Add(reconcilerCronConfiguration); err != nil { _ = logging.Errorf("error adding watcher to config %q: %v", reconcilerCronConfiguration, err) - os.Exit(1234) + os.Exit(fileWatcherAddWatcherError) } for {