1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Error types for the vst3-host library
use thiserror::Error;
/// Main error type for vst3-host operations.
///
/// Marked `#[non_exhaustive]`: match with a wildcard arm, as new variants may be added in
/// future versions without it being a breaking change.
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum Error {
/// Plugin file not found
#[error("Plugin not found: {0}")]
PluginNotFound(String),
/// Failed to load plugin
#[error("Failed to load plugin: {0}")]
PluginLoadFailed(String),
/// Plugin crashed during operation
#[error("Plugin crashed")]
PluginCrashed,
/// Plugin operation timed out
#[error("Plugin operation timed out")]
PluginTimeout,
/// Invalid parameter
#[error("Invalid parameter: {0}")]
InvalidParameter(String),
/// Audio backend error
#[error("Audio backend error: {0}")]
AudioBackendError(String),
/// MIDI error
#[error("MIDI error: {0}")]
MidiError(String),
/// COM/VST3 interface error
#[error("VST3 interface error: {0}")]
InterfaceError(String),
/// Process isolation error
#[error("Process isolation error: {0}")]
ProcessError(String),
/// IO error
#[error(transparent)]
IoError(#[from] std::io::Error),
/// The plugin's `process()` returned a failure code. Carries the raw tresult rather than a
/// formatted `String` so returning it from the audio callback allocates nothing.
#[error("Plugin process() failed: {0:#x}")]
ProcessFailed(i32),
/// The plugin is not currently active/processing. A unit variant for the same reason as
/// [`Self::ProcessFailed`] — this is rejected on the audio path once per block while stopped.
#[error("Plugin is not processing")]
NotProcessing,
/// Other errors
#[error("{0}")]
Other(String),
}
/// Convenient Result type alias
pub type Result<T> = std::result::Result<T, Error>;