diff --git a/z/errors.go b/z/errors.go index 3f8a05c..986c29b 100644 --- a/z/errors.go +++ b/z/errors.go @@ -12,6 +12,8 @@ func (e NotEnoughArgs) Error() string { "error: %v is not enough args, %v required", e.Count, e.Min) } +// -------------------------------- -- -------------------------------- + type TooManyArgs struct { Count int Max int @@ -22,6 +24,8 @@ func (e TooManyArgs) Error() string { "error: %v is too many args, %v maximum", e.Count, e.Max) } +// -------------------------------- -- -------------------------------- + type WrongNumArgs struct { Count 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) } +// -------------------------------- -- -------------------------------- + type MissingConf struct { Path string } @@ -40,6 +46,18 @@ func (e MissingConf) Error() string { 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 { Cmd *Cmd } @@ -48,6 +66,8 @@ func (e UsesConf) Error() string { return fmt.Sprintf("%v requires Z.Conf", e.Cmd.Name) } +// -------------------------------- -- -------------------------------- + type UsesVars struct { Cmd *Cmd } @@ -56,6 +76,8 @@ func (e UsesVars) Error() string { return fmt.Sprintf("%v requires Z.Vars", e.Cmd.Name) } +// -------------------------------- -- -------------------------------- + type NoCallNoCommands struct { Cmd *Cmd } @@ -64,6 +86,8 @@ func (e NoCallNoCommands) Error() string { return fmt.Sprintf("%v requires either Call or Commands", e.Cmd.Name) } +// -------------------------------- -- -------------------------------- + type DefCmdReqCall struct { Cmd *Cmd } @@ -72,6 +96,8 @@ func (e DefCmdReqCall) Error() string { return fmt.Sprintf("default (first) %q Commands requires Call", e.Cmd.Name) } +// -------------------------------- -- -------------------------------- + type IncorrectUsage struct { Cmd *Cmd } @@ -80,6 +106,8 @@ func (e IncorrectUsage) Error() string { return fmt.Sprintf("usage: %v %v", e.Cmd.Name, e.Cmd.GetUsage()) } +// -------------------------------- -- -------------------------------- + type MultiCallCmdNotFound struct { CmdName string } @@ -88,6 +116,8 @@ func (e MultiCallCmdNotFound) Error() string { return fmt.Sprintf("multicall command not found: %v", e.CmdName) } +// -------------------------------- -- -------------------------------- + type MultiCallCmdNotCmd struct { CmdName string 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) } +// -------------------------------- -- -------------------------------- + type MultiCallCmdArgNotString struct { CmdName string It any