From a9c04117c5d045dc0b2a8308361a4644d7bfd79e Mon Sep 17 00:00:00 2001 From: Denis Gukov Date: Fri, 17 Sep 2021 02:35:44 +0500 Subject: [PATCH] fix(be): correct error message for foreign key errors --- db/sql/SqlDb.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/sql/SqlDb.go b/db/sql/SqlDb.go index 32224787b..a1fd7dfa5 100644 --- a/db/sql/SqlDb.go +++ b/db/sql/SqlDb.go @@ -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 }