@@ -28,8 +28,10 @@ import (
2828 "fmt"
2929 "reflect"
3030
31+ "github.com/arangodb/kube-arangodb/pkg/util/errors"
32+
3133 "github.com/arangodb/kube-arangodb/pkg/util"
32- "github.com/pkg/errors"
34+
3335 core "k8s.io/api/core/v1"
3436)
3537
@@ -44,7 +46,7 @@ func validatePullPolicy(v core.PullPolicy) error {
4446 case "" , core .PullAlways , core .PullNever , core .PullIfNotPresent :
4547 return nil
4648 default :
47- return maskAny (errors .Wrapf (ValidationError , "Unknown pull policy: '%s'" , string (v )))
49+ return errors . WithStack (errors .Wrapf (ValidationError , "Unknown pull policy: '%s'" , string (v )))
4850 }
4951}
5052
@@ -328,64 +330,64 @@ func (s *DeploymentSpec) SetDefaultsFrom(source DeploymentSpec) {
328330// Return errors when validation fails, nil on success.
329331func (s * DeploymentSpec ) Validate () error {
330332 if err := s .GetMode ().Validate (); err != nil {
331- return maskAny (errors .Wrap (err , "spec.mode" ))
333+ return errors . WithStack (errors .Wrap (err , "spec.mode" ))
332334 }
333335 if err := s .GetEnvironment ().Validate (); err != nil {
334- return maskAny (errors .Wrap (err , "spec.environment" ))
336+ return errors . WithStack (errors .Wrap (err , "spec.environment" ))
335337 }
336338 if err := s .GetStorageEngine ().Validate (); err != nil {
337- return maskAny (errors .Wrap (err , "spec.storageEngine" ))
339+ return errors . WithStack (errors .Wrap (err , "spec.storageEngine" ))
338340 }
339341 if err := validatePullPolicy (s .GetImagePullPolicy ()); err != nil {
340- return maskAny (errors .Wrap (err , "spec.imagePullPolicy" ))
342+ return errors . WithStack (errors .Wrap (err , "spec.imagePullPolicy" ))
341343 }
342344 if s .GetImage () == "" {
343- return maskAny (errors .Wrapf (ValidationError , "spec.image must be set" ))
345+ return errors . WithStack (errors .Wrapf (ValidationError , "spec.image must be set" ))
344346 }
345347 if err := s .ExternalAccess .Validate (); err != nil {
346- return maskAny (errors .Wrap (err , "spec.externalAccess" ))
348+ return errors . WithStack (errors .Wrap (err , "spec.externalAccess" ))
347349 }
348350 if err := s .RocksDB .Validate (); err != nil {
349- return maskAny (errors .Wrap (err , "spec.rocksdb" ))
351+ return errors . WithStack (errors .Wrap (err , "spec.rocksdb" ))
350352 }
351353 if err := s .Authentication .Validate (false ); err != nil {
352- return maskAny (errors .Wrap (err , "spec.auth" ))
354+ return errors . WithStack (errors .Wrap (err , "spec.auth" ))
353355 }
354356 if err := s .TLS .Validate (); err != nil {
355- return maskAny (errors .Wrap (err , "spec.tls" ))
357+ return errors . WithStack (errors .Wrap (err , "spec.tls" ))
356358 }
357359 if err := s .Sync .Validate (s .GetMode ()); err != nil {
358- return maskAny (errors .Wrap (err , "spec.sync" ))
360+ return errors . WithStack (errors .Wrap (err , "spec.sync" ))
359361 }
360362 if err := s .Single .Validate (ServerGroupSingle , s .GetMode ().HasSingleServers (), s .GetMode (), s .GetEnvironment ()); err != nil {
361- return maskAny (err )
363+ return errors . WithStack (err )
362364 }
363365 if err := s .Agents .Validate (ServerGroupAgents , s .GetMode ().HasAgents (), s .GetMode (), s .GetEnvironment ()); err != nil {
364- return maskAny (err )
366+ return errors . WithStack (err )
365367 }
366368 if err := s .DBServers .Validate (ServerGroupDBServers , s .GetMode ().HasDBServers (), s .GetMode (), s .GetEnvironment ()); err != nil {
367- return maskAny (err )
369+ return errors . WithStack (err )
368370 }
369371 if err := s .Coordinators .Validate (ServerGroupCoordinators , s .GetMode ().HasCoordinators (), s .GetMode (), s .GetEnvironment ()); err != nil {
370- return maskAny (err )
372+ return errors . WithStack (err )
371373 }
372374 if err := s .SyncMasters .Validate (ServerGroupSyncMasters , s .Sync .IsEnabled (), s .GetMode (), s .GetEnvironment ()); err != nil {
373- return maskAny (err )
375+ return errors . WithStack (err )
374376 }
375377 if err := s .SyncWorkers .Validate (ServerGroupSyncWorkers , s .Sync .IsEnabled (), s .GetMode (), s .GetEnvironment ()); err != nil {
376- return maskAny (err )
378+ return errors . WithStack (err )
377379 }
378380 if err := s .Metrics .Validate (); err != nil {
379- return maskAny (errors .Wrap (err , "spec.metrics" ))
381+ return errors . WithStack (errors .Wrap (err , "spec.metrics" ))
380382 }
381383 if err := s .Chaos .Validate (); err != nil {
382- return maskAny (errors .Wrap (err , "spec.chaos" ))
384+ return errors . WithStack (errors .Wrap (err , "spec.chaos" ))
383385 }
384386 if err := s .License .Validate (); err != nil {
385- return maskAny (errors .Wrap (err , "spec.licenseKey" ))
387+ return errors . WithStack (errors .Wrap (err , "spec.licenseKey" ))
386388 }
387389 if err := s .Bootstrap .Validate (); err != nil {
388- return maskAny (err )
390+ return errors . WithStack (err )
389391 }
390392 return nil
391393}
0 commit comments