errors.go 1.3 KB

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