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)
| 178 | // so they surface as ValidationError on --output. Mkdir / write failures |
| 179 | // are local I/O issues classified as InternalError with SubtypeFileIO. |
| 180 | func 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 |
no test coverage detected