errors.go 1.2 KB

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