MCPcopy Create free account
hub / github.com/ProspectOne/perfops-cli / chkRunError

Function chkRunError

cmd/root.go:124–136  ·  view source on GitHub ↗
(err error)

Source from the content-addressed store, hash-verified

122}
123
124func chkRunError(err error) error {
125 type argNamer interface {
126 ArgName() string
127 }
128 if perfops.IsUnauthorized(err) {
129 // A bit of a hack...
130 err = errors.New("The API token was declined. Please correct it or do not send a token to use the free plan.")
131 } else if namer, ok := err.(argNamer); ok {
132 rootCmd.SetHelpFunc(invalidArgHelp(namer.ArgName()))
133 err = flag.ErrHelp
134 }
135 return err
136}
137
138func invalidArgHelp(name string) func(cmd *cobra.Command, args []string) {
139 if name == "limit" {

Callers 10

mtr.goFile · 0.85
ping.goFile · 0.85
credits.goFile · 0.85
dnsperf.goFile · 0.85
traceroute.goFile · 0.85
TestChkRunErrorFunction · 0.85
latency.goFile · 0.85
curl.goFile · 0.85
dnsresolve.goFile · 0.85
list.goFile · 0.85

Calls 3

IsUnauthorizedFunction · 0.92
invalidArgHelpFunction · 0.85
ArgNameMethod · 0.65

Tested by 1

TestChkRunErrorFunction · 0.68