Error catalogue¶
afmpeg standardises on a single error library — cockroachdb/errors
— for creation and wrapping, with user-facing hints where useful. Every exported
sentinel error (var ErrX = errors.New(...) in pkg/) is documented here; this is
enforced advisorily by scripts/lint-docs-errors.sh (the just check target), which
fails if a sentinel in pkg/ is missing from this page.
Sentinels¶
ErrNoModule¶
Returned by afmpeg.New when no wasm module source is configured. The GPL
ffmpeg.wasm is never embedded (spec 0004 D-C), so one of WithModuleFile,
WithModuleBytes, WithModuleFS, or WithModuleURL is mandatory. Callers match
with errors.Is(err, afmpeg.ErrNoModule).
ErrChecksumMismatch¶
Returned when a module obtained via WithModuleURL + WithSHA256 does not match
the expected SHA-256 — the download is rejected rather than executed. Callers
match with errors.Is(err, afmpeg.ErrChecksumMismatch).
Convention¶
- A non-zero ffmpeg exit is not a Go error by itself —
Runreturns aResultcarrying the exit code + stderr tail, and a nil error. Host-side failures (module instantiation, the vfs bridge, context cancellation) return a non-nil error. A consumer that prefers an error on failure inspectsResult.ExitCodeand wraps it with the stderr tail itself. - Wrap, don't reformat:
errors.Wrap/Wrapfto add context; reserve sentinels for conditions callers branch on.