Skip to content

Commit

Permalink
bulker: print detailed errors for BQ load jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
absorbb committed Nov 21, 2023
1 parent 31b2277 commit e0a2b39
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bulkerlib/implementations/sql/bigquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,15 @@ func (bq *BigQuery) LoadTable(ctx context.Context, targetTable *Table, loadSourc
return err
}
if err := status.Err(); err != nil {
return err
builder := strings.Builder{}
builder.WriteString(fmt.Sprintf("Failed to load table %s. Job ID: %s Completed with error: %s", tableName, job.ID(), err.Error()))
if len(status.Errors) > 0 {
builder.WriteString("\nDetailed errors:")
for _, statusError := range status.Errors {
builder.WriteString(fmt.Sprintf("\n%s", statusError.Error()))
}
}
return errors.New(builder.String())
}
return nil
}
Expand Down

0 comments on commit e0a2b39

Please sign in to comment.