Skip to content

Commit defa4d7

Browse files
committed
* Wrapped retry operation errors with errors.WithStackTrace(err)
1 parent 3def68b commit defa4d7

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Removed `trace.Driver.OnClusterUpdate` event
44
* Fixed bug with unexpected changing of local datacenter flag in endpoint
55
* Refactored errors wrapping (stackedError are not ydb error now, checking `errors.IsYdb(err)` with `errors.As` now)
6+
* Wrapped retry operation errors with `errors.WithStackTrace(err)`
67

78
## v3.16.9
89
* Refactored internal operation and transport errors

internal/table/retry.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func doTx(ctx context.Context, c SessionProvider, op table.TxOperation, opts tab
6262
err = op(ctx, tx)
6363

6464
if err != nil {
65-
return err
65+
return errors.WithStackTrace(err)
6666
}
6767

6868
_, err = tx.CommitTx(ctx, opts.TxCommitOptions...)
@@ -96,7 +96,13 @@ func do(ctx context.Context, c SessionProvider, op table.Operation, opts table.O
9696
attempts++
9797
}()
9898

99-
return op(ctx, s)
99+
err = op(ctx, s)
100+
101+
if err != nil {
102+
return errors.WithStackTrace(err)
103+
}
104+
105+
return nil
100106
},
101107
)
102108
}
@@ -236,11 +242,11 @@ func retryBackoff(
236242
}
237243

238244
if !m.MustRetry(isOperationIdempotent) {
239-
return
245+
return errors.WithStackTrace(err)
240246
}
241247

242248
if retry.Wait(ctx, fastBackoff, slowBackoff, m, i) != nil {
243-
return
249+
return errors.WithStackTrace(err)
244250
}
245251

246252
code = m.StatusCode()

retry/retry.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ func Retry(ctx context.Context, op retryOperation, opts ...retryOption) (err err
152152
}
153153

154154
if !m.MustRetry(h.idempotent) {
155-
return
155+
return errors.WithStackTrace(err)
156156
}
157157

158158
if e := Wait(ctx, h.fastBackoff, h.slowBackoff, m, i); e != nil {
159-
return
159+
return errors.WithStackTrace(err)
160160
}
161161

162162
code = m.StatusCode()

0 commit comments

Comments
 (0)