essentia_core/algorithm/
error.rs1use thiserror::Error;
2
3use crate::data::{ConversionError, DataType};
4
5#[derive(Debug, Error)]
6pub enum ParameterError {
7 #[error("Parameter '{parameter}' not found")]
8 ParameterNotFound { parameter: String },
9
10 #[error("Type mismatch for parameter '{parameter}': expected {expected}, found {actual}")]
11 TypeMismatch {
12 parameter: String,
13 expected: DataType,
14 actual: DataType,
15 },
16
17 #[error("Failed to convert data for parameter '{parameter}': {source}")]
18 DataConversion {
19 parameter: String,
20 #[source]
21 source: ConversionError,
22 },
23}
24
25#[derive(Debug, Error)]
26pub enum ConfigurationError {
27 #[error("Configuration failed: {0}")]
28 Internal(#[from] cxx::Exception),
29}
30
31#[derive(Debug, Error)]
32pub enum InputError {
33 #[error("Input '{input}' not found")]
34 InputNotFound { input: String },
35
36 #[error("Type mismatch for input '{input}': expected {expected}, found {actual}")]
37 TypeMismatch {
38 input: String,
39 expected: DataType,
40 actual: DataType,
41 },
42
43 #[error("Failed to convert data for input '{input}': {source}")]
44 DataConversion {
45 input: String,
46 #[source]
47 source: ConversionError,
48 },
49
50 #[error("Internal error for input '{input}': {source}")]
51 Internal {
52 input: String,
53 #[source]
54 source: cxx::Exception,
55 },
56}
57
58#[derive(Debug, Error)]
59pub enum OutputError {
60 #[error("Output '{output}' not found")]
61 OutputNotFound { output: String },
62
63 #[error("Type mismatch for output '{output}': expected {expected}, found {actual}")]
64 TypeMismatch {
65 output: String,
66 expected: DataType,
67 actual: DataType,
68 },
69
70 #[error("Internal error for output '{output}': {source}")]
71 Internal {
72 output: String,
73 #[source]
74 source: cxx::Exception,
75 },
76}
77
78#[derive(Debug, Error)]
79pub enum ComputeError {
80 #[error("Failed to setup output '{output}': {source}")]
81 OutputSetup {
82 output: String,
83 #[source]
84 source: cxx::Exception,
85 },
86
87 #[error("Computation failed: {0}")]
88 Compute(#[from] cxx::Exception),
89}
90
91#[derive(Debug, Error)]
92pub enum ResetError {
93 #[error("Reset failed: {0}")]
94 Internal(#[from] cxx::Exception),
95}