Merge pull request #217 from rjnagal/bigquery

Improve error reporting on bigquery row insertion failure.
This commit is contained in:
monnand 2014-09-05 15:46:20 -04:00
commit e870cfa66f

View File

@ -218,7 +218,13 @@ func (c *Client) InsertRow(rowData map[string]interface{}) error {
} }
if len(result.InsertErrors) > 0 { 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 return nil
} }