Skip to content

Commit

Permalink
fix(be): correct error message for foreign key errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed Sep 16, 2021
1 parent 858f135 commit a9c0411
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions db/sql/SqlDb.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ var (
// validateMutationResult checks the success of the update query
func validateMutationResult(res sql.Result, err error) error {
if err != nil {
if strings.Contains(err.Error(), "foreign key") {
err = db.ErrInvalidOperation
}
return err
}

Expand Down

0 comments on commit a9c0411

Please sign in to comment.