Skip to main content

vst3_host/
error.rs

1//! Error types for the vst3-host library
2
3use thiserror::Error;
4
5/// Main error type for vst3-host operations.
6///
7/// Marked `#[non_exhaustive]`: match with a wildcard arm, as new variants may be added in
8/// future versions without it being a breaking change.
9#[derive(Error, Debug)]
10#[non_exhaustive]
11pub enum Error {
12    /// Plugin file not found
13    #[error("Plugin not found: {0}")]
14    PluginNotFound(String),
15
16    /// Failed to load plugin
17    #[error("Failed to load plugin: {0}")]
18    PluginLoadFailed(String),
19
20    /// Plugin crashed during operation
21    #[error("Plugin crashed")]
22    PluginCrashed,
23
24    /// Plugin operation timed out
25    #[error("Plugin operation timed out")]
26    PluginTimeout,
27
28    /// Invalid parameter
29    #[error("Invalid parameter: {0}")]
30    InvalidParameter(String),
31
32    /// Audio backend error
33    #[error("Audio backend error: {0}")]
34    AudioBackendError(String),
35
36    /// MIDI error
37    #[error("MIDI error: {0}")]
38    MidiError(String),
39
40    /// COM/VST3 interface error
41    #[error("VST3 interface error: {0}")]
42    InterfaceError(String),
43
44    /// Process isolation error
45    #[error("Process isolation error: {0}")]
46    ProcessError(String),
47
48    /// IO error
49    #[error(transparent)]
50    IoError(#[from] std::io::Error),
51
52    /// Other errors
53    #[error("{0}")]
54    Other(String),
55}
56
57/// Convenient Result type alias
58pub type Result<T> = std::result::Result<T, Error>;