From 1cdf355c25ed9b278110b118ed2e6c6c73e405d5 Mon Sep 17 00:00:00 2001 From: Rohit Jnagal Date: Fri, 5 Sep 2014 19:29:44 +0000 Subject: [PATCH] Improve error reporting on bigquery row insertion failure. Docker-DCO-1.1-Signed-off-by: Rohit Jnagal (github: rjnagal) --- storage/bigquery/client/client.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/storage/bigquery/client/client.go b/storage/bigquery/client/client.go index 4e807632..e509502c 100644 --- a/storage/bigquery/client/client.go +++ b/storage/bigquery/client/client.go @@ -218,7 +218,13 @@ func (c *Client) InsertRow(rowData map[string]interface{}) error { } if len(result.InsertErrors) > 0 { - return fmt.Errorf("Insertion for %d rows failed") + errstr := fmt.Sprintf("Insertion for %d rows failed\n", len(result.InsertErrors)) + for _, errors := range result.InsertErrors { + for _, errorproto := range errors.Errors { + errstr += fmt.Sprintf("Error inserting row %d: %+v\n", errors.Index, errorproto) + } + } + return fmt.Errorf(errstr) } return nil }