fix: Improve errors in batch modes

This commit is contained in:
Yevgeny Pats 2022-12-18 11:45:38 +02:00 committed by Jack Christensen
parent 1ce3e0384a
commit 11fa083a0d

View File

@ -1106,6 +1106,8 @@ func (c *Conn) sendBatchExtendedWithDescription(ctx context.Context, b *Batch, d
for _, bi := range b.queuedQueries {
err := c.eqb.Build(c.typeMap, bi.sd, bi.arguments)
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}
}