webhook.go 797 B

12345678910111213141516171819202122232425262728293031323334353637
  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 WebhookNotExist struct {
  9. ID int64
  10. }
  11. func IsWebhookNotExist(err error) bool {
  12. _, ok := err.(WebhookNotExist)
  13. return ok
  14. }
  15. func (err WebhookNotExist) Error() string {
  16. return fmt.Sprintf("webhook does not exist [id: %d]", err.ID)
  17. }
  18. type HookTaskNotExist struct {
  19. HookID int64
  20. UUID string
  21. }
  22. func IsHookTaskNotExist(err error) bool {
  23. _, ok := err.(HookTaskNotExist)
  24. return ok
  25. }
  26. func (err HookTaskNotExist) Error() string {
  27. return fmt.Sprintf("hook task does not exist [hook_id: %d, uuid: %s]", err.HookID, err.UUID)
  28. }