From 11fa083a0dc248ef7b74c20b560470b682a359f7 Mon Sep 17 00:00:00 2001 From: Yevgeny Pats <16490766+yevgenypats@users.noreply.github.com> Date: Sun, 18 Dec 2022 11:45:38 +0200 Subject: [PATCH] fix: Improve errors in batch modes --- conn.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conn.go b/conn.go index 4c8b59da..b6c1ab8f 100644 --- a/conn.go +++ b/conn.go @@ -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} }