diff options
author | guillep2k <18600385+guillep2k@users.noreply.github.com> | 2019-10-02 19:28:30 -0300 |
---|---|---|
committer | Antoine GIRARD <sapk@users.noreply.github.com> | 2019-10-03 00:28:30 +0200 |
commit | cd13f273d1663ef5f1f506bf3824f79bc73656ff (patch) | |
tree | 71fbbbe24ec017482fb9c81b68643ef0ceca4b37 /models/error.go | |
parent | c9f819eae0ac9cdce82e25abe25c067b1927e923 (diff) | |
download | gitea-cd13f273d1663ef5f1f506bf3824f79bc73656ff.tar.gz gitea-cd13f273d1663ef5f1f506bf3824f79bc73656ff.zip |
Transaction-aware retry create issue to cope with duplicate keys (#8307)
* Revert #7898
* Transaction-aware retry create issue to cope with duplicate keys
* Restore INSERT ... WHERE usage
* Rearrange code for clarity
* Fix error return in newIssue()
* Fix error message
Diffstat (limited to 'models/error.go')
-rw-r--r-- | models/error.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/models/error.go b/models/error.go index 9974287a0a..995617e83b 100644 --- a/models/error.go +++ b/models/error.go @@ -1089,6 +1089,21 @@ func (err ErrIssueLabelTemplateLoad) Error() string { return fmt.Sprintf("Failed to load label template file '%s': %v", err.TemplateFile, err.OriginalError) } +// ErrNewIssueInsert is used when the INSERT statement in newIssue fails +type ErrNewIssueInsert struct { + OriginalError error +} + +// IsErrNewIssueInsert checks if an error is a ErrNewIssueInsert. +func IsErrNewIssueInsert(err error) bool { + _, ok := err.(ErrNewIssueInsert) + return ok +} + +func (err ErrNewIssueInsert) Error() string { + return err.OriginalError.Error() +} + // __________ .__ .__ __________ __ // \______ \__ __| | | |\______ \ ____ ________ __ ____ _______/ |_ // | ___/ | \ | | | | _// __ \/ ____/ | \_/ __ \ / ___/\ __\ |