Improve error reporting on bigquery row insertion failure.

Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
This commit is contained in:
Rohit Jnagal 2014-09-05 19:29:44 +00:00
parent 4706361784
commit 1cdf355c25

View File

@ -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
}