Skip to main content

secs_engine/
error.rs

1//! Engine errors.
2
3/// Why a design cannot be computed. Messages are for logs; the service maps
4/// variants to user-facing error codes.
5#[derive(Debug, thiserror::Error)]
6pub enum EngineError {
7    /// Resampling was requested for a rate outside the converter's bounds.
8    #[error("invalid input: position {position} {role}: cannot resample sample rate {actual_hz}")]
9    UnsupportedResamplingRate {
10        position: u32,
11        role: String,
12        actual_hz: u32,
13    },
14    /// An input failure without a structured measurement diagnostic.
15    #[error("invalid input: {0}")]
16    Input(String),
17    /// A channel's measurement does not use the engine sample rate.
18    #[error(
19        "invalid input: position {position} {role}: sample rate {actual_hz} (expected {expected_hz})"
20    )]
21    MeasurementSampleRate {
22        position: u32,
23        role: String,
24        actual_hz: u32,
25        expected_hz: u32,
26    },
27    /// An IR is empty, or its samples/time origin contain a nonfinite value.
28    #[error("invalid input: position {position} {role}: empty or nonfinite IR")]
29    InvalidMeasurement { position: u32, role: String },
30    /// A position contains two measurements assigned to the same role.
31    #[error("invalid input: position {position}: duplicate role {role}")]
32    DuplicateMeasurement { position: u32, role: String },
33    /// The configured reference position has no measurements.
34    #[error("invalid input: missing main position")]
35    MissingReferencePosition { position: u32 },
36    /// The reference position has no measurement of a configured main speaker.
37    #[error("invalid input: no measured main")]
38    MissingMainMeasurement { position: u32 },
39    /// A DSP primitive rejected its arguments.
40    #[error(transparent)]
41    Dsp(#[from] secs_dsp::DspError),
42    /// The computation was cancelled.
43    #[error("cancelled")]
44    Cancelled,
45}