//! 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), /// TRACES: FR-EXP-2 /// The frame was rendered into one colour space and asked to be labelled /// another. /// /// Not a limitation of the encoders — all four spaces embed a correct /// profile. It is that the conversion happens in the shader, before the /// clip to 0..1, so a frame is in exactly one space by the time it gets /// here. The caller composes with `EditGraph::compose_for` to change which. #[error( "the frame was rendered in {} but a {} file was asked for", .rendered.label(), .requested.label() )] ColourSpaceMismatch { rendered: ColourSpace, requested: ColourSpace, }, #[error("encoding failed: {0}")] Encode(String), }