Skip to content

Commit a95794d

Browse files
authored
Merge pull request #149 from six-group/improve_errors
improve handle error
2 parents e735bbd + 68f1694 commit a95794d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

controllers/instance/instance_controller.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
configv1alpha1 "github.com/six-group/haproxy-operator/apis/config/v1alpha1"
77
proxyv1alpha1 "github.com/six-group/haproxy-operator/apis/proxy/v1alpha1"
8+
"go.uber.org/multierr"
89
"k8s.io/apimachinery/pkg/api/errors"
910
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1011
"k8s.io/apimachinery/pkg/runtime"
@@ -119,7 +120,7 @@ func (r *Reconciler) handleError(ctx context.Context, instance *proxyv1alpha1.In
119120
Error: err.Error(),
120121
}
121122

122-
return r.Status().Update(ctx, instance)
123+
return multierr.Combine(err, r.Status().Update(ctx, instance))
123124
}
124125

125126
func (r *Reconciler) updateConfig(ctx context.Context, instance *proxyv1alpha1.Instance, listens *configv1alpha1.ListenList, frontends *configv1alpha1.FrontendList, backends *configv1alpha1.BackendList, resolvers *configv1alpha1.ResolverList) {

controllers/instance/instance_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ var _ = Describe("Reconcile", Label("controller"), func() {
475475
Scheme: scheme,
476476
}
477477
result, err := r.Reconcile(ctx, ctrl.Request{NamespacedName: types.NamespacedName{Name: proxy.Name, Namespace: proxy.Namespace}})
478-
Ω(err).ShouldNot(HaveOccurred())
478+
Ω(err).Should(HaveOccurred())
479479
Ω(result).ShouldNot(BeNil())
480480

481481
Ω(cli.Get(ctx, client.ObjectKeyFromObject(proxy), proxy)).ShouldNot(HaveOccurred())

0 commit comments

Comments
 (0)