From 28135c0d8278119b36cf2187068af36f84d95b4c Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Mon, 1 Apr 2019 17:11:30 +0200 Subject: [PATCH] Add cluster context to handled errors --- cluster/manager.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cluster/manager.go b/cluster/manager.go index 172a439900..39350027d8 100644 --- a/cluster/manager.go +++ b/cluster/manager.go @@ -20,16 +20,17 @@ import ( "strings" "time" - "github.com/banzaicloud/pipeline/auth" - "github.com/banzaicloud/pipeline/config" - pipelineContext "github.com/banzaicloud/pipeline/internal/platform/context" - "github.com/banzaicloud/pipeline/model" "github.com/goph/emperror" "github.com/patrickmn/go-cache" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" "github.com/spf13/viper" "go.uber.org/cadence/client" + + "github.com/banzaicloud/pipeline/auth" + "github.com/banzaicloud/pipeline/config" + pipelineContext "github.com/banzaicloud/pipeline/internal/platform/context" + "github.com/banzaicloud/pipeline/model" ) type clusterRepository interface { @@ -111,6 +112,13 @@ func (c clusterErrorHandler) Handle(err error) { } _ = c.cluster.SetStatus(c.status, statusMessage) } + + err = emperror.With( + err, + "clusterId", c.cluster.GetID(), + "clusterName", c.cluster.GetName(), + ) + c.handler.Handle(err) }