Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use a minimal record when an error occurs #101

Merged
merged 1 commit into from
Oct 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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