voicemeeter\interface\parameters/
errors.rs1use crate::types::ZIndex;
2
3#[derive(thiserror::Error, Debug, Clone)]
5#[error("out of range: {name}({index}) is not supported on `{program}`")]
6pub struct OutOfRangeError {
7 pub name: String,
9 pub index: ZIndex,
11 pub program: super::VoicemeeterApplication,
13}
14
15#[derive(thiserror::Error, Debug, Clone)]
17#[error("invalid device: {device:?} is not supported on `{program}`")]
18#[non_exhaustive]
19pub struct DeviceError {
20 pub program: super::VoicemeeterApplication,
22 pub device: crate::types::Device,
24}
25
26#[derive(thiserror::Error, Debug, Clone)]
28#[non_exhaustive]
29pub enum InvalidTypeError {
30 #[error(
32 "{name}[{strip_index}] needs to be a physical {name} for access to parameter `{parameter}`"
33 )]
34 ExpectedPhysical {
35 name: &'static str,
37 strip_index: ZIndex,
39 parameter: String,
41 },
42 #[error(
44 "{name}[{strip_index}] needs to be a virtual {name} for access to parameter `{parameter}`"
45 )]
46 ExpectedVirtual {
47 name: &'static str,
49 strip_index: ZIndex,
51 parameter: String,
53 },
54 #[error("expected a strip, got `{device}`")]
56 ExpectedStrip {
57 device: String,
59 },
60 #[error("expected a bus, got `{device}`")]
62 ExpectedBus {
63 device: String,
65 },
66}
67
68#[derive(thiserror::Error, Debug, Clone)]
70#[error("{parameter} requires programs {expected:?} to be accessed, program is {found}")]
71pub struct InvalidVoicemeeterVersion {
72 pub expected: &'static [super::VoicemeeterApplication],
74 pub found: super::VoicemeeterApplication,
76 pub parameter: String,
78}
79
80#[derive(thiserror::Error, Debug, Clone)]
82pub enum ParameterError {
83 #[error(transparent)]
85 Version(#[from] InvalidVoicemeeterVersion),
86 #[error(transparent)]
88 Type(#[from] InvalidTypeError),
89 #[error(transparent)]
91 OutOfRange(#[from] OutOfRangeError),
92 #[error(transparent)]
94 Device(#[from] DeviceError),
95}