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

Function classifySaveErr

internal/client/response.go:180–185  ·  view source on GitHub ↗

classifySaveErr routes a SaveResponse error to the right typed shape. Path-validation failures are caller-induced (an unsafe --output path), so they surface as ValidationError on --output. Mkdir / write failures are local I/O issues classified as InternalError with SubtypeFileIO.

(err error)

Source from the content-addressed store, hash-verified

178// so they surface as ValidationError on --output. Mkdir / write failures
179// are local I/O issues classified as InternalError with SubtypeFileIO.
180func classifySaveErr(err error) error {
181 if errors.Is(err, fileio.ErrPathValidation) {
182 return errs.NewValidationError(errs.SubtypeInvalidArgument, "%v", err).WithParam("--output")
183 }
184 return errs.NewInternalError(errs.SubtypeFileIO, "save response: %v", err).WithCause(err)
185}
186
187// ── JSON helpers ──
188

Callers 2

HandleResponseFunction · 0.85
saveAndPrintFunction · 0.85

Calls 5

NewValidationErrorFunction · 0.92
NewInternalErrorFunction · 0.92
IsMethod · 0.80
WithParamMethod · 0.80
WithCauseMethod · 0.45

Tested by

no test coverage detected