mirror of
https://github.com/jackc/pgx.git
synced 2025-05-31 11:42:24 +00:00
fix: Improve errors in batch modes
This commit is contained in:
parent
1ce3e0384a
commit
11fa083a0d
2
conn.go
2
conn.go
@ -1106,6 +1106,8 @@ func (c *Conn) sendBatchExtendedWithDescription(ctx context.Context, b *Batch, d
|
|||||||
for _, bi := range b.queuedQueries {
|
for _, bi := range b.queuedQueries {
|
||||||
err := c.eqb.Build(c.typeMap, bi.sd, bi.arguments)
|
err := c.eqb.Build(c.typeMap, bi.sd, bi.arguments)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// we wrap the error so we the user can understand which query failed inside the batch
|
||||||
|
err = fmt.Errorf("error building query %s: %w", bi.query, err)
|
||||||
return &pipelineBatchResults{ctx: ctx, conn: c, err: err}
|
return &pipelineBatchResults{ctx: ctx, conn: c, err: err}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user