Skip to content

Commit

Permalink
Merge pull request #14 from qor/import-error-report-bug-fix
Browse files Browse the repository at this point in the history
Clear errors after handle
  • Loading branch information
sunfmin authored Aug 5, 2019
2 parents 3f8de49 + 31a25a5 commit cbc64a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ func (res *Resource) Import(container Container, context *qor.Context, callbacks
if errors, ok := err.(errorsInterface); ok {
for _, err := range errors.GetErrors() {
handleError(err)

}
} else if errValidations, ok := err.(*validations.Error); ok {
for idx, cell := range progress.Cells {
Expand Down Expand Up @@ -160,6 +159,7 @@ func (res *Resource) Import(container Container, context *qor.Context, callbacks
}
} else {
handleError(context.Errors)
clearContextErrorsForCurrentRow(context)
}
} else {
handleError(err)
Expand All @@ -178,6 +178,9 @@ func (res *Resource) Import(container Container, context *qor.Context, callbacks
}
return err
}
func clearContextErrorsForCurrentRow(context *qor.Context) {
context.Errors = qor.Errors{}
}

// Export used export data from a exchange Resource
// product.Export(csv.New("products.csv"), context)
Expand Down

0 comments on commit cbc64a4

Please sign in to comment.