Add separation and MissingVar to errors

main
Rob Muhlestein 2 years ago
parent a135921e96
commit 72f64a8244

@ -12,6 +12,8 @@ func (e NotEnoughArgs) Error() string {
"error: %v is not enough args, %v required", e.Count, e.Min) "error: %v is not enough args, %v required", e.Count, e.Min)
} }
// -------------------------------- -- --------------------------------
type TooManyArgs struct { type TooManyArgs struct {
Count int Count int
Max int Max int
@ -22,6 +24,8 @@ func (e TooManyArgs) Error() string {
"error: %v is too many args, %v maximum", e.Count, e.Max) "error: %v is too many args, %v maximum", e.Count, e.Max)
} }
// -------------------------------- -- --------------------------------
type WrongNumArgs struct { type WrongNumArgs struct {
Count int Count int
Num int Num int
@ -32,6 +36,8 @@ func (e WrongNumArgs) Error() string {
"error: %v is wrong number of args, %v required", e.Count, e.Num) "error: %v is wrong number of args, %v required", e.Count, e.Num)
} }
// -------------------------------- -- --------------------------------
type MissingConf struct { type MissingConf struct {
Path string Path string
} }
@ -40,6 +46,18 @@ func (e MissingConf) Error() string {
return fmt.Sprintf("missing conf value for %v", e.Path) return fmt.Sprintf("missing conf value for %v", e.Path)
} }
// -------------------------------- -- --------------------------------
type MissingVar struct {
Path string
}
func (e MissingVar) Error() string {
return fmt.Sprintf("missing var for %v", e.Path)
}
// -------------------------------- -- --------------------------------
type UsesConf struct { type UsesConf struct {
Cmd *Cmd Cmd *Cmd
} }
@ -48,6 +66,8 @@ func (e UsesConf) Error() string {
return fmt.Sprintf("%v requires Z.Conf", e.Cmd.Name) return fmt.Sprintf("%v requires Z.Conf", e.Cmd.Name)
} }
// -------------------------------- -- --------------------------------
type UsesVars struct { type UsesVars struct {
Cmd *Cmd Cmd *Cmd
} }
@ -56,6 +76,8 @@ func (e UsesVars) Error() string {
return fmt.Sprintf("%v requires Z.Vars", e.Cmd.Name) return fmt.Sprintf("%v requires Z.Vars", e.Cmd.Name)
} }
// -------------------------------- -- --------------------------------
type NoCallNoCommands struct { type NoCallNoCommands struct {
Cmd *Cmd Cmd *Cmd
} }
@ -64,6 +86,8 @@ func (e NoCallNoCommands) Error() string {
return fmt.Sprintf("%v requires either Call or Commands", e.Cmd.Name) return fmt.Sprintf("%v requires either Call or Commands", e.Cmd.Name)
} }
// -------------------------------- -- --------------------------------
type DefCmdReqCall struct { type DefCmdReqCall struct {
Cmd *Cmd Cmd *Cmd
} }
@ -72,6 +96,8 @@ func (e DefCmdReqCall) Error() string {
return fmt.Sprintf("default (first) %q Commands requires Call", e.Cmd.Name) return fmt.Sprintf("default (first) %q Commands requires Call", e.Cmd.Name)
} }
// -------------------------------- -- --------------------------------
type IncorrectUsage struct { type IncorrectUsage struct {
Cmd *Cmd Cmd *Cmd
} }
@ -80,6 +106,8 @@ func (e IncorrectUsage) Error() string {
return fmt.Sprintf("usage: %v %v", e.Cmd.Name, e.Cmd.GetUsage()) return fmt.Sprintf("usage: %v %v", e.Cmd.Name, e.Cmd.GetUsage())
} }
// -------------------------------- -- --------------------------------
type MultiCallCmdNotFound struct { type MultiCallCmdNotFound struct {
CmdName string CmdName string
} }
@ -88,6 +116,8 @@ func (e MultiCallCmdNotFound) Error() string {
return fmt.Sprintf("multicall command not found: %v", e.CmdName) return fmt.Sprintf("multicall command not found: %v", e.CmdName)
} }
// -------------------------------- -- --------------------------------
type MultiCallCmdNotCmd struct { type MultiCallCmdNotCmd struct {
CmdName string CmdName string
It any It any
@ -98,6 +128,8 @@ func (e MultiCallCmdNotCmd) Error() string {
"multicall match for %v, but first in slice not *Z.Cmd: %T", e.CmdName, e.It) "multicall match for %v, but first in slice not *Z.Cmd: %T", e.CmdName, e.It)
} }
// -------------------------------- -- --------------------------------
type MultiCallCmdArgNotString struct { type MultiCallCmdArgNotString struct {
CmdName string CmdName string
It any It any

Loading…
Cancel
Save