Skip to content

Commit 8677467

Browse files
fix(bigquery): panic-ing due to invalid type for structpb (#411)
* fix: bigquery extractor panic * refactor(agent): use better error message on panic
1 parent 0aba47c commit 8677467

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

agent/agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func (r *Agent) Run(ctx context.Context, recipe recipe.Recipe) (run Run) {
171171
go func() {
172172
defer func() {
173173
if r := recover(); r != nil {
174-
run.Error = fmt.Errorf("%s", r)
174+
run.Error = fmt.Errorf("agent run: close stream: panic: %s", r)
175175
}
176176
stream.Close()
177177
}()

plugins/extractors/bigquery/bigquery.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,9 @@ func (e *Extractor) extractTable(ctx context.Context, ds *bigquery.Dataset, emit
150150
tb := ds.Tables(ctx)
151151
for {
152152
table, err := tb.Next()
153-
if err == iterator.Done {
153+
if errors.Is(err, iterator.Done) || errors.Is(err, context.Canceled) {
154154
break
155-
}
156-
if err != nil {
155+
} else if err != nil {
157156
e.logger.Error("failed to get table, skipping table", "err", err)
158157
continue
159158
}
@@ -220,7 +219,6 @@ func (e *Extractor) buildAsset(ctx context.Context, t *bigquery.Table, md *bigqu
220219
"project": t.ProjectID,
221220
"type": string(md.Type),
222221
"partition_field": partitionField,
223-
"labels": md.Labels,
224222
}),
225223
})
226224
if err != nil {
@@ -234,6 +232,7 @@ func (e *Extractor) buildAsset(ctx context.Context, t *bigquery.Table, md *bigqu
234232
Description: md.Description,
235233
Service: "bigquery",
236234
Data: table,
235+
Labels: md.Labels,
237236
CreateTime: timestamppb.New(md.CreationTime),
238237
UpdateTime: timestamppb.New(md.LastModifiedTime),
239238
}, nil

0 commit comments

Comments
 (0)