From 563b935fe7e6d8fbfd1d660f351b2c7c4bd3db67 Mon Sep 17 00:00:00 2001 From: Preston Baxter Date: Tue, 21 Nov 2023 19:32:49 -0600 Subject: [PATCH] B: disable colors in logging --- service/controllers/controllers.go | 2 +- ui/controllers/actions.go | 15 ++++++++++++--- ui/controllers/controllers.go | 2 +- versions.json | 4 ++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/service/controllers/controllers.go b/service/controllers/controllers.go index d590e72..55d4101 100644 --- a/service/controllers/controllers.go +++ b/service/controllers/controllers.go @@ -22,7 +22,7 @@ func BuildRouter(r *gin.Engine) { log = logrus.New() log.SetFormatter(&logrus.TextFormatter{ - ForceColors: true, + DisableColors: true, }) var err error diff --git a/ui/controllers/actions.go b/ui/controllers/actions.go index 6e8bb13..fbdb7e6 100644 --- a/ui/controllers/actions.go +++ b/ui/controllers/actions.go @@ -1,6 +1,7 @@ package controllers import ( + "errors" "fmt" "strings" @@ -90,7 +91,12 @@ func AddActionFromForm(c *gin.Context) { }, } - mongo.SaveModel(am) + err := mongo.SaveModel(am) + if err != nil { + log.WithError(err).Error("Failed to setup actions") + serverError(c, "Failed to setup actions") + return + } c.Redirect(302, "/dashboard") } @@ -110,6 +116,9 @@ func setupPcoSubscriptions(user *models.User) error { //Check if subscriptions already exist webhookMap := make(map[string]webhooks.Subscription) subscriptions, err := pcoApi.GetSubscriptions() + if err != nil { + return errors.Join(fmt.Errorf("Failed to find subscriptions for user: %s", user.Id), err) + } //Loop through found subscriptions for _, sub := range subscriptions { //if subsciption is in the templates look to add it to our map @@ -137,13 +146,13 @@ func setupPcoSubscriptions(user *models.User) error { //Post Subscriptions subscriptions, err = pcoApi.CreateSubscriptions(builtHooks) if err != nil { - return err + return errors.Join(fmt.Errorf("Failed to create subscriptions for user: %s", user.Id), err) } //Save Subscriptions err = mongo.SaveSubscriptionsForUser(user.Id, subscriptions...) if err != nil { - return err + return errors.Join(fmt.Errorf("Failed to save subscriptions for user: %s", user.Id), err) } return nil diff --git a/ui/controllers/controllers.go b/ui/controllers/controllers.go index a4a99aa..9a31da1 100644 --- a/ui/controllers/controllers.go +++ b/ui/controllers/controllers.go @@ -22,7 +22,7 @@ func BuildRouter(r *gin.Engine) { log = logrus.New() log.SetFormatter(&logrus.TextFormatter{ - ForceColors: true, + DisableColors: true, }) r.Use(cors.Default()) diff --git a/versions.json b/versions.json index 3c34152..de96e15 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,4 @@ { - "webhook_version": "0.0.20", - "frontend_version": "0.0.20" + "webhook_version": "0.0.21", + "frontend_version": "0.0.21" }