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

Function wrapMarkdownDownloadError

shortcuts/markdown/markdown_errors.go:45–53  ·  view source on GitHub ↗

wrapMarkdownDownloadError classifies a download failure. An already-typed error keeps its carrier — type, subtype, code and extensions — so callers see the upstream classification: a validation problem passes through verbatim, any other problem gains a "download failed" prefix for operation context.

(err error)

Source from the content-addressed store, hash-verified

43// An untyped error becomes a network transport error carrying the original as
44// its cause.
45func wrapMarkdownDownloadError(err error) error {
46 if p, ok := errs.ProblemOf(err); ok {
47 if p.Category != errs.CategoryValidation {
48 p.Message = "download failed: " + p.Message
49 }
50 return err
51 }
52 return errs.NewNetworkError(errs.SubtypeNetworkTransport, "download failed: %s", err).WithCause(err)
53}

Callers 6

openMarkdownDownloadFunction · 0.85
markdown_fetch.goFile · 0.85
markdown_patch.goFile · 0.85
downloadMarkdownContentFunction · 0.85

Calls 3

ProblemOfFunction · 0.92
NewNetworkErrorFunction · 0.92
WithCauseMethod · 0.45

Tested by 1