@@ -179,7 +179,7 @@ func (l *LoadBalancerOps) Create(
179179
180180 result , _ , err := l .LBClient .Create (ctx , opts )
181181 if err != nil {
182- return nil , fmt .Errorf ("%s: %w" , op , err )
182+ return nil , fmt .Errorf ("%s: %w" , op , withInvalidInputFields ( err ) )
183183 }
184184 if err := l .ActionClient .WaitFor (ctx , result .Action ); err != nil {
185185 return nil , fmt .Errorf ("%s: %w" , op , err )
@@ -302,7 +302,7 @@ func (l *LoadBalancerOps) changeHCLBInfo(ctx context.Context, lb *hcloud.LoadBal
302302
303303 updated , _ , err := l .LBClient .Update (ctx , lb , opts )
304304 if err != nil {
305- return false , fmt .Errorf ("%s: %w" , op , err )
305+ return false , fmt .Errorf ("%s: %w" , op , withInvalidInputFields ( err ) )
306306 }
307307 lb .Name = updated .Name
308308 lb .Labels = updated .Labels
@@ -326,7 +326,7 @@ func (l *LoadBalancerOps) changeIPv4RDNS(ctx context.Context, lb *hcloud.LoadBal
326326
327327 action , _ , err := l .LBClient .ChangeDNSPtr (ctx , lb , lb .PublicNet .IPv4 .IP .String (), & rdns )
328328 if err != nil {
329- return false , fmt .Errorf ("%s: %w" , op , err )
329+ return false , fmt .Errorf ("%s: %w" , op , withInvalidInputFields ( err ) )
330330 }
331331 err = l .ActionClient .WaitFor (ctx , action )
332332 if err != nil {
@@ -351,7 +351,7 @@ func (l *LoadBalancerOps) changeIPv6RDNS(ctx context.Context, lb *hcloud.LoadBal
351351
352352 action , _ , err := l .LBClient .ChangeDNSPtr (ctx , lb , lb .PublicNet .IPv6 .IP .String (), & rdns )
353353 if err != nil {
354- return false , fmt .Errorf ("%s: %w" , op , err )
354+ return false , fmt .Errorf ("%s: %w" , op , withInvalidInputFields ( err ) )
355355 }
356356 err = l .ActionClient .WaitFor (ctx , action )
357357 if err != nil {
@@ -382,7 +382,7 @@ func (l *LoadBalancerOps) changeAlgorithm(ctx context.Context, lb *hcloud.LoadBa
382382 opts := hcloud.LoadBalancerChangeAlgorithmOpts {Type : at }
383383 action , _ , err := l .LBClient .ChangeAlgorithm (ctx , lb , opts )
384384 if err != nil {
385- return false , fmt .Errorf ("%s: %w" , op , err )
385+ return false , fmt .Errorf ("%s: %w" , op , withInvalidInputFields ( err ) )
386386 }
387387 err = l .ActionClient .WaitFor (ctx , action )
388388 if err != nil {
@@ -409,7 +409,7 @@ func (l *LoadBalancerOps) changeType(ctx context.Context, lb *hcloud.LoadBalance
409409 opts := hcloud.LoadBalancerChangeTypeOpts {LoadBalancerType : & hcloud.LoadBalancerType {Name : lt }}
410410 action , _ , err := l .LBClient .ChangeType (ctx , lb , opts )
411411 if err != nil {
412- return false , fmt .Errorf ("%s: %w" , op , err )
412+ return false , fmt .Errorf ("%s: %w" , op , withInvalidInputFields ( err ) )
413413 }
414414 err = l .ActionClient .WaitFor (ctx , action )
415415 if err != nil {
@@ -515,7 +515,7 @@ func (l *LoadBalancerOps) attachToNetwork(ctx context.Context, lb *hcloud.LoadBa
515515 a , _ , err = l .LBClient .AttachToNetwork (ctx , lb , opts )
516516 }
517517 if err != nil {
518- return false , fmt .Errorf ("%s: %w" , op , err )
518+ return false , fmt .Errorf ("%s: %w" , op , withInvalidInputFields ( err ) )
519519 }
520520
521521 if err := l .ActionClient .WaitFor (ctx , a ); err != nil {
@@ -954,7 +954,7 @@ func (l *LoadBalancerOps) ReconcileHCLBServices(
954954 }
955955 action , _ , err = l .LBClient .UpdateService (ctx , lb , b .listenPort , updOpts )
956956 if err != nil {
957- return changed , fmt .Errorf ("%s: %w" , op , err )
957+ return changed , fmt .Errorf ("%s: %w" , op , withInvalidInputFields ( err ) )
958958 }
959959 } else {
960960 klog .InfoS ("add service" , "op" , op , "port" , portNo , "loadBalancerID" , lb .ID )
@@ -965,7 +965,7 @@ func (l *LoadBalancerOps) ReconcileHCLBServices(
965965 }
966966 action , _ , err = l .LBClient .AddService (ctx , lb , addOpts )
967967 if err != nil {
968- return changed , fmt .Errorf ("%s: %w" , op , err )
968+ return changed , fmt .Errorf ("%s: %w" , op , withInvalidInputFields ( err ) )
969969 }
970970 }
971971
0 commit comments