summaryrefslogtreecommitdiffstats
path: root/models/error.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-04-26 11:03:39 +0800
committerGitHub <noreply@github.com>2019-04-26 11:03:39 +0800
commit4c34bc111ce020161a2fbd962a19a9123b3e2dc4 (patch)
treefd7dae27b71494ae7707644b2368e89d155d3956 /models/error.go
parentec2d489d15580ba934f34d8cdf3d779e1d64374d (diff)
downloadgitea-4c34bc111ce020161a2fbd962a19a9123b3e2dc4.tar.gz
gitea-4c34bc111ce020161a2fbd962a19a9123b3e2dc4.zip
fix pulls broken when fork repository deleted (#6754)
* fix pulls broken when fork repository deleted * fix lint
Diffstat (limited to 'models/error.go')
-rw-r--r--models/error.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/models/error.go b/models/error.go
index 6458594a03..febe3f3e04 100644
--- a/models/error.go
+++ b/models/error.go
@@ -1091,6 +1091,24 @@ func (err ErrPullRequestAlreadyExists) Error() string {
err.ID, err.IssueID, err.HeadRepoID, err.BaseRepoID, err.HeadBranch, err.BaseBranch)
}
+// ErrPullRequestHeadRepoMissing represents a "ErrPullRequestHeadRepoMissing" error
+type ErrPullRequestHeadRepoMissing struct {
+ ID int64
+ HeadRepoID int64
+}
+
+// IsErrErrPullRequestHeadRepoMissing checks if an error is a ErrPullRequestHeadRepoMissing.
+func IsErrErrPullRequestHeadRepoMissing(err error) bool {
+ _, ok := err.(ErrPullRequestHeadRepoMissing)
+ return ok
+}
+
+// Error does pretty-printing :D
+func (err ErrPullRequestHeadRepoMissing) Error() string {
+ return fmt.Sprintf("pull request head repo missing [id: %d, head_repo_id: %d]",
+ err.ID, err.HeadRepoID)
+}
+
// ErrInvalidMergeStyle represents an error if merging with disabled merge strategy
type ErrInvalidMergeStyle struct {
ID int64