//! TRACES: NFR-ARCH-4 //! Typed export failures. //! //! Every variant is something a caller can act on or report. A batch export //! runs unattended over hundreds of frames (FR-EXP-7), so "what went wrong //! with which file" has to survive as data rather than as a log line. use dr_types::{ColourSpace, ExportFormat}; #[derive(Debug, thiserror::Error)] pub enum ExportError { #[error("frame buffer is {got} bytes, expected {expected}")] FrameSize { expected: usize, got: usize }, #[error("frame has no pixels")] EmptyFrame, /// Asked for a format with no encoder in this build. /// /// Not a panic and not a silent substitution: the settings page offers /// AVIF and JPEG XL because FR-EXP-1 lists them, and a build without them /// should say so rather than quietly writing a JPEG under a `.avif` name. #[error("{} export is not supported yet", .0.label())] FormatUnsupported(ExportFormat), /// Asked for a colour space the pipeline does not render to. /// /// See the note in `export`: the shader clips to sRGB before this crate /// sees a pixel, so a wider space could only be a mislabelling. #[error("{} export needs a pipeline that renders to it", .0.label())] ColourSpaceUnsupported(ColourSpace), #[error("encoding failed: {0}")] Encode(String), }