MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / wrapArgs

Function wrapArgs

cmd/errors.go:19–26  ·  view source on GitHub ↗

usageErr returns an error wrapping ErrUsage. Works like fmt.Errorf but automatically prepends the sentinel so isUserError catches it. wrapArgs wraps a Cobra positional-args validator so that its errors are tagged with ErrUsage, keeping them out of Sentry.

(fn cobra.PositionalArgs)

Source from the content-addressed store, hash-verified

17// wrapArgs wraps a Cobra positional-args validator so that its errors
18// are tagged with ErrUsage, keeping them out of Sentry.
19func wrapArgs(fn cobra.PositionalArgs) cobra.PositionalArgs {
20 return func(cmd *cobra.Command, args []string) error {
21 if err := fn(cmd, args); err != nil {
22 return fmt.Errorf("%w: %s", ErrUsage, err)
23 }
24 return nil
25 }
26}
27
28func usageErr(format string, args ...any) error {
29 return fmt.Errorf("%w: "+format, append([]any{ErrUsage}, args...)...)

Callers 4

scp.goFile · 0.85
delete.goFile · 0.85
modify.goFile · 0.85
snapshot_delete.goFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected