File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,8 @@ func (g IDGenerator) NextID(ctx context.Context) (int, error) {
9393
9494 var newID * int
9595
96+ var errs []error
97+
9698 id , err := retry .DoWithData (func () (* int , error ) {
9799 if g .config .RandomIDs {
98100 //nolint:gosec
@@ -109,6 +111,8 @@ func (g IDGenerator) NextID(ctx context.Context) (int, error) {
109111 retry .OnRetry (func (_ uint , err error ) {
110112 if strings .Contains (err .Error (), "already exists" ) && newID != nil {
111113 newID = ptr .Ptr (* newID + 1 )
114+ } else {
115+ errs = append (errs , err )
112116 }
113117 }),
114118 retry .Context (ctx ),
@@ -117,7 +121,8 @@ func (g IDGenerator) NextID(ctx context.Context) (int, error) {
117121 retry .Delay (200 * time .Millisecond ),
118122 )
119123 if err != nil {
120- return - 1 , fmt .Errorf ("unable to retrieve the next available VM identifier: %w" , err )
124+ errs = append (errs , err )
125+ return - 1 , fmt .Errorf ("unable to retrieve the next available VM identifier: %w" , errors .Join (errs ... ))
121126 }
122127
123128 if ! g .config .RandomIDs {
You can’t perform that action at this time.
0 commit comments