errors.go 1012 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package main
  2. import "github.com/leonelquinteros/gotext"
  3. type SetPkgReasonError struct {
  4. exp bool // explicit
  5. }
  6. func (e *SetPkgReasonError) Error() string {
  7. reason := gotext.Get("explicit")
  8. if !e.exp {
  9. reason = gotext.Get("dependency")
  10. }
  11. return gotext.Get("error updating package install reason to %s", reason)
  12. }
  13. type FindPkgDestError struct {
  14. name, pkgDest string
  15. }
  16. func (e *FindPkgDestError) Error() string {
  17. return gotext.Get(
  18. "the PKGDEST for %s is listed by makepkg but does not exist: %s",
  19. e.name, e.pkgDest)
  20. }
  21. type PkgDestNotInListError struct {
  22. name string
  23. }
  24. func (e *PkgDestNotInListError) Error() string {
  25. return gotext.Get("could not find PKGDEST for: %s", e.name)
  26. }
  27. type FailedIgnoredPkgError struct {
  28. pkgErrors map[string]error
  29. }
  30. func (e *FailedIgnoredPkgError) Error() string {
  31. msg := gotext.Get("Failed to install the following packages. Manual intervention is required:")
  32. for pkg, err := range e.pkgErrors {
  33. msg += "\n" + pkg + " - " + err.Error()
  34. }
  35. return msg
  36. }