@@ -305,7 +305,7 @@ func (c *Client) BulkUpsert(
305305 // We must send requests in chunks to avoid exceeding the maximum message size
306306 chunks , err = chunkBulkUpsertRequest (chunks , request , c .config .MaxRequestMessageSize ())
307307 if err != nil {
308- return xerrors . WithStackTrace ( err )
308+ return err
309309 }
310310
311311 return c .sendBulkUpsertRequest (ctx , chunks , opts ... )
@@ -371,8 +371,10 @@ func chunkBulkUpsertRequest(
371371
372372 // not a row bulk upsert request -> ret original request
373373 if req .GetRows () == nil || req .GetRows ().GetValue () == nil {
374- return nil , fmt .Errorf ("ydb: request size (%d bytes) exceeds maximum size (%d bytes) " +
375- " but cannot be chunked (only row-based bulk upserts support chunking)" , reqSize , maxBytes )
374+ return nil , xerrors .WithStackTrace (
375+ xerrors .Wrap (
376+ fmt .Errorf ("ydb: request size (%d bytes) exceeds maximum size (%d bytes) " +
377+ " but cannot be chunked (only row-based bulk upserts support chunking)" , reqSize , maxBytes )))
376378 }
377379
378380 n := len (req .GetRows ().GetValue ().GetItems ())
@@ -382,8 +384,10 @@ func chunkBulkUpsertRequest(
382384
383385 // we cannot split one item and one item is too big
384386 if n == 1 {
385- return nil , fmt .Errorf ("ydb: single row size (%d bytes) exceeds maximum request size (%d bytes) " +
386- "- row is too large to process" , reqSize , maxBytes )
387+ return nil , xerrors .WithStackTrace (
388+ xerrors .Wrap (
389+ fmt .Errorf ("ydb: single row size (%d bytes) exceeds maximum request size (%d bytes) " +
390+ "- row is too large to process" , reqSize , maxBytes )))
387391 }
388392
389393 left , right := splitBulkUpsertRequestAt (req , n / 2 )
@@ -404,7 +408,7 @@ func splitBulkUpsertRequestAt(req *Ydb_Table.BulkUpsertRequest, pos int) (_, _ *
404408 items := req .GetRows ().GetValue ().GetItems () // save original items
405409 req .Rows .Value .Items = nil
406410
407- right , _ := proto .Clone (req ).(* Ydb_Table.BulkUpsertRequest )
411+ right := proto .Clone (req ).(* Ydb_Table.BulkUpsertRequest ) //nolint:forcetypeassert
408412
409413 req .Rows .Value .Items = items [:pos ]
410414 right .Rows .Value .Items = items [pos :]
0 commit comments