@@ -1089,14 +1089,14 @@ func (a *Allocator) reallocateNode(ctx context.Context, nodeID string) error {
10891089
10901090 networks , err := a .getNodeNetworks (node .ID )
10911091 if err != nil {
1092- return errors . Wrapf ( err , "error getting networks for node %v" , nodeID )
1092+ return fmt . Errorf ( "error getting networks for node %v: %w " , nodeID , err )
10931093 }
10941094 if a .allocateNode (ctx , node , false , networks ) {
10951095 // if something was allocated, commit the node
10961096 if err := a .store .Batch (func (batch * store.Batch ) error {
10971097 return a .commitAllocatedNode (ctx , batch , node )
10981098 }); err != nil {
1099- return errors . Wrapf ( err , "error committing allocation for node %v" , nodeID )
1099+ return fmt . Errorf ( "error committing allocation for node %v: %w " , nodeID , err )
11001100 }
11011101 }
11021102 return nil
@@ -1112,7 +1112,7 @@ func (a *Allocator) commitAllocatedNode(ctx context.Context, batch *store.Batch,
11121112 err = store .UpdateNode (tx , storeNode )
11131113 }
11141114
1115- return errors . Wrapf ( err , "failed updating state in store transaction for node %s" , node .ID )
1115+ return fmt . Errorf ( "failed updating state in store transaction for node %s: %w " , node .ID , err )
11161116 }); err != nil {
11171117 if err := a .deallocateNode (node ); err != nil {
11181118 log .G (ctx ).WithError (err ).Errorf ("failed rolling back allocation of node %s" , node .ID )
@@ -1254,7 +1254,7 @@ func (a *Allocator) commitAllocatedService(ctx context.Context, batch *store.Bat
12541254 err = store .UpdateService (tx , storeService )
12551255 }
12561256
1257- return errors . Wrapf ( err , "failed updating state in store transaction for service %s" , s .ID )
1257+ return fmt . Errorf ( "failed updating state in store transaction for service %s: %w " , s .ID , err )
12581258 }); err != nil {
12591259 if err := a .netCtx .deallocateService (s ); err != nil {
12601260 log .G (ctx ).WithError (err ).Errorf ("failed rolling back allocation of service %s" , s .ID )
@@ -1280,7 +1280,7 @@ func (a *Allocator) allocateNetwork(ctx context.Context, n *api.Network) error {
12801280func (a * Allocator ) commitAllocatedNetwork (ctx context.Context , batch * store.Batch , n * api.Network ) error {
12811281 if err := batch .Update (func (tx store.Tx ) error {
12821282 if err := store .UpdateNetwork (tx , n ); err != nil {
1283- return errors . Wrapf ( err , "failed updating state in store transaction for network %s" , n .ID )
1283+ return fmt . Errorf ( "failed updating state in store transaction for network %s: %w " , n .ID , err )
12841284 }
12851285 return nil
12861286 }); err != nil {
@@ -1385,7 +1385,7 @@ func (a *Allocator) commitAllocatedTask(ctx context.Context, batch *store.Batch,
13851385 err = store .UpdateTask (tx , storeTask )
13861386 }
13871387
1388- return errors . Wrapf ( err , "failed updating state in store transaction for task %s" , t .ID )
1388+ return fmt . Errorf ( "failed updating state in store transaction for task %s: %w " , t .ID , err )
13891389 })
13901390
13911391 if retError == nil {
0 commit comments