webhook.go 725 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2017 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package errors
  5. import "fmt"
  6. type WebhookNotExist struct {
  7. ID int64
  8. }
  9. func IsWebhookNotExist(err error) bool {
  10. _, ok := err.(WebhookNotExist)
  11. return ok
  12. }
  13. func (err WebhookNotExist) Error() string {
  14. return fmt.Sprintf("webhook does not exist [id: %d]", err.ID)
  15. }
  16. type HookTaskNotExist struct {
  17. HookID int64
  18. UUID string
  19. }
  20. func IsHookTaskNotExist(err error) bool {
  21. _, ok := err.(HookTaskNotExist)
  22. return ok
  23. }
  24. func (err HookTaskNotExist) Error() string {
  25. return fmt.Sprintf("hook task does not exist [hook_id: %d, uuid: %s]", err.HookID, err.UUID)
  26. }