sdt_walk_error.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. package hhc_common
  2. import "fmt"
  3. type SDTWalkError interface {
  4. FES() string // Friendly Error String
  5. EES() string // Expert Error String
  6. }
  7. type SDTWalkError_NullPointerException struct {
  8. RelyToken string
  9. RelyEntity string
  10. }
  11. func (e SDTWalkError_NullPointerException) FES() string {
  12. return "go-hhc-cli parser internal error"
  13. }
  14. func (e SDTWalkError_NullPointerException) EES() string {
  15. return fmt.Sprint("null pointer exception. rely token:", e.RelyToken, "rely entity:", e.RelyEntity)
  16. }
  17. type SDTWalkError_UnrecognizedCommand struct {
  18. RelyToken string
  19. }
  20. func (e SDTWalkError_UnrecognizedCommand) FES() string {
  21. return fmt.Sprint("unrecognized command: ", e.RelyToken)
  22. }
  23. func (e SDTWalkError_UnrecognizedCommand) EES() string {
  24. return fmt.Sprint("unrecognized command: ", e.RelyToken)
  25. }
  26. type SDTWalkError_RootNodeCannotFallback struct {
  27. }
  28. func (e SDTWalkError_RootNodeCannotFallback) FES() string {
  29. return "go-hhc-cli parser internal error"
  30. }
  31. func (e SDTWalkError_RootNodeCannotFallback) EES() string {
  32. return "root node can not fallback"
  33. }
  34. type SDTWalkError_IncompleteCommand struct {
  35. }
  36. func (e SDTWalkError_IncompleteCommand) FES() string {
  37. return "incomplete command"
  38. }
  39. func (e SDTWalkError_IncompleteCommand) EES() string {
  40. return "incomplete command"
  41. }
  42. type SDTWalkError_LossingParent struct {
  43. RelyName string
  44. }
  45. func (e SDTWalkError_LossingParent) FES() string {
  46. return "go-hhc-cli parser internal error"
  47. }
  48. func (e SDTWalkError_LossingParent) EES() string {
  49. return fmt.Sprint("lossing parent for", e.RelyName)
  50. }
  51. type SDTWalkError_TooManyParameters struct {
  52. }
  53. func (e SDTWalkError_TooManyParameters) FES() string {
  54. return "too many parameters"
  55. }
  56. func (e SDTWalkError_TooManyParameters) EES() string {
  57. return "too many parameters"
  58. }
  59. type SDTWalkError_TooShortPrefix struct {
  60. }
  61. func (e SDTWalkError_TooShortPrefix) FES() string {
  62. return "your input prefix too short so it means multiple selection"
  63. }
  64. func (e SDTWalkError_TooShortPrefix) EES() string {
  65. return "too short prefix"
  66. }