issue.go 841 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Copyright 2018 Gitote. All rights reserved.
  3. //
  4. // This source code is licensed under the MIT license found in the
  5. // LICENSE file in the root directory of this source tree.
  6. package errors
  7. import "fmt"
  8. type IssueNotExist struct {
  9. ID int64
  10. RepoID int64
  11. Index int64
  12. }
  13. func IsIssueNotExist(err error) bool {
  14. _, ok := err.(IssueNotExist)
  15. return ok
  16. }
  17. func (err IssueNotExist) Error() string {
  18. return fmt.Sprintf("issue does not exist [id: %d, repo_id: %d, index: %d]", err.ID, err.RepoID, err.Index)
  19. }
  20. type InvalidIssueReference struct {
  21. Ref string
  22. }
  23. func IsInvalidIssueReference(err error) bool {
  24. _, ok := err.(InvalidIssueReference)
  25. return ok
  26. }
  27. func (err InvalidIssueReference) Error() string {
  28. return fmt.Sprintf("invalid issue reference [ref: %s]", err.Ref)
  29. }