You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.0 KiB

  1. // Copyright 2015 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 git
  5. import (
  6. "fmt"
  7. "time"
  8. )
  9. type ErrExecTimeout struct {
  10. Duration time.Duration
  11. }
  12. func IsErrExecTimeout(err error) bool {
  13. _, ok := err.(ErrExecTimeout)
  14. return ok
  15. }
  16. func (err ErrExecTimeout) Error() string {
  17. return fmt.Sprintf("execution is timeout [duration: %v]", err.Duration)
  18. }
  19. type ErrNotExist struct {
  20. ID string
  21. RelPath string
  22. }
  23. func IsErrNotExist(err error) bool {
  24. _, ok := err.(ErrNotExist)
  25. return ok
  26. }
  27. func (err ErrNotExist) Error() string {
  28. return fmt.Sprintf("object does not exist [id: %s, rel_path: %s]", err.ID, err.RelPath)
  29. }
  30. type ErrUnsupportedVersion struct {
  31. Required string
  32. }
  33. func IsErrUnsupportedVersion(err error) bool {
  34. _, ok := err.(ErrUnsupportedVersion)
  35. return ok
  36. }
  37. func (err ErrUnsupportedVersion) Error() string {
  38. return fmt.Sprintf("Operation requires higher version [required: %s]", err.Required)
  39. }