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)
| 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. |
| 28 | func 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 |
no test coverage detected