Skip to content

Commit 86b9915

Browse files
committed
Added stacktrace to errors with issues
1 parent 5bd7b48 commit 86b9915

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
* Added stacktrace to errors with issues
2+
13
## v3.16.10
24
* Refactored `cluster.Cluster` and `balancer.Balancer` interfaces (removed `Update` method)
35
* Replaced `cluster.Update` with `cluster.Remove` and `cluster.Insert` calls

internal/cluster/cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func (c *cluster) Close(ctx context.Context) (err error) {
239239
}
240240

241241
if len(issues) > 0 {
242-
return errors.NewWithIssues("cluster closed with issues", issues...)
242+
return errors.WithStackTrace(errors.NewWithIssues("cluster closed with issues", issues...))
243243
}
244244

245245
return nil

internal/conn/conn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (c *conn) Release(ctx context.Context) (err error) {
8080
}
8181

8282
if len(issues) > 0 {
83-
return errors.NewWithIssues("conn released with issues", issues...)
83+
return errors.WithStackTrace(errors.NewWithIssues("conn released with issues", issues...))
8484
}
8585

8686
return nil

internal/table/client.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,7 @@ func (c *client) Close(ctx context.Context) (err error) {
495495
c.wgClosed.Wait()
496496

497497
if len(issues) > 0 {
498-
return errors.WithStackTrace(errors.NewWithIssues(
499-
"table client closed with issues",
500-
issues...,
501-
))
498+
return errors.WithStackTrace(errors.NewWithIssues("table client closed with issues", issues...))
502499
}
503500

504501
return nil

options.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,13 @@ func WithConnectionString(connectionString string) Option {
8686
}
8787
issues = append(issues, err)
8888
}
89-
return errors.NewWithIssues(
90-
"parse connection string '"+connectionString+"' failed:",
91-
issues...,
92-
)
89+
if len(issues) > 0 {
90+
return errors.WithStackTrace(errors.NewWithIssues(
91+
"parse connection string '"+connectionString+"' failed:",
92+
issues...,
93+
))
94+
}
95+
return nil
9396
}
9497
}
9598

0 commit comments

Comments
 (0)