MCPcopy
hub / github.com/larksuite/cli / withMarkdownFileParam

Function withMarkdownFileParam

shortcuts/markdown/markdown_errors.go:28–37  ·  view source on GitHub ↗

withMarkdownFileParam tags a validation failure with the originating flag when it does not already name one. Shared input-file helpers such as common.WrapInputStatErrorTyped cannot know which flag supplied the path, so the caller attaches it here to keep the recoverable param on the wire.

(err error, param string)

Source from the content-addressed store, hash-verified

26// common.WrapInputStatErrorTyped cannot know which flag supplied the path, so
27// the caller attaches it here to keep the recoverable param on the wire.
28func withMarkdownFileParam(err error, param string) error {
29 if err == nil || param == "" {
30 return err
31 }
32 var ve *errs.ValidationError
33 if errors.As(err, &ve) && ve.Param == "" {
34 ve.WithParam(param)
35 }
36 return err
37}
38
39// wrapMarkdownDownloadError classifies a download failure. An already-typed
40// error keeps its carrier — type, subtype, code and extensions — so callers see

Callers 4

markdownSourceSizeFunction · 0.85
uploadMarkdownFileAllFunction · 0.85
readMarkdownLocalFileFunction · 0.85

Calls 2

WithParamMethod · 0.95
AsMethod · 0.80

Tested by

no test coverage detected