fix(be): correct error message for foreign key errors

This commit is contained in:
Denis Gukov 2021-09-17 02:35:44 +05:00
parent 858f135fd0
commit a9c04117c5

View File

@ -51,6 +51,9 @@ var (
// validateMutationResult checks the success of the update query // validateMutationResult checks the success of the update query
func validateMutationResult(res sql.Result, err error) error { func validateMutationResult(res sql.Result, err error) error {
if err != nil { if err != nil {
if strings.Contains(err.Error(), "foreign key") {
err = db.ErrInvalidOperation
}
return err return err
} }