MCPcopy
hub / github.com/netdata/netdata / ValidateArgs

Method ValidateArgs

src/go/plugin/framework/dyncfg/function.go:105–110  ·  view source on GitHub ↗

ValidateArgs checks if the function has at least the required number of arguments. Returns an error with a descriptive message if validation fails.

(required int)

Source from the content-addressed store, hash-verified

103// ValidateArgs checks if the function has at least the required number of arguments.
104// Returns an error with a descriptive message if validation fails.
105func (f Function) ValidateArgs(required int) error {
106 if len(f.fn.Args) < required {
107 return fmt.Errorf("missing required arguments: need %d, got %d", required, len(f.fn.Args))
108 }
109 return nil
110}
111
112// ValidateHasPayload checks if the function has a payload.
113// Returns an error if the payload is empty.

Callers 6

CmdAddMethod · 0.80
dyncfgConfigMethod · 0.80
dyncfgConfigMethod · 0.80
dyncfgCmdAddMethod · 0.80
dyncfgCmdTestMethod · 0.80
dyncfgCmdAddMethod · 0.80

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected