Skip to content

Commit

Permalink
feat: use a minimal record when an error occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Oct 7, 2018
1 parent 98c3f66 commit 9a074ee
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd_airtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ func airtableSync(opts *airtableOptions) error {
}
logger().Debug("creating airtable record without slices", zap.String("URL", issue.URL))
r := issue.ToAirtableRecord()
r.Fields.Labels = []string{}
r.Fields.Assignees = []string{}
r.Fields = airtableIssue{
URL: r.Fields.URL,
}
if err := table.Create(&r); err != nil {
return err
}
Expand All @@ -124,8 +125,9 @@ func airtableSync(opts *airtableOptions) error {
record.Fields = issue.ToAirtableRecord().Fields
if err := table.Update(&record); err != nil {
logger().Warn("failed to update record, retrying without slices", zap.String("URL", issue.URL), zap.Error(err))
record.Fields.Labels = []string{}
record.Fields.Assignees = []string{}
record.Fields = airtableIssue{
URL: record.Fields.URL,
}
if typedErr, ok := err.(airtable.ErrClientRequest); ok {
record.Fields.Errors = typedErr.Err.Error()
} else {
Expand Down

0 comments on commit 9a074ee

Please sign in to comment.