]> code.octet-stream.net Git - m17rt/blobdiff - m17codec2/src/error.rs
Split m17codec2 into modules
[m17rt] / m17codec2 / src / error.rs
diff --git a/m17codec2/src/error.rs b/m17codec2/src/error.rs
new file mode 100644 (file)
index 0000000..ccf94b9
--- /dev/null
@@ -0,0 +1,22 @@
+use thiserror::Error;
+
+#[derive(Debug, Error)]
+pub enum M17Codec2Error {
+    #[error("selected card '{0}' does not exist or is in use")]
+    CardUnavailable(String),
+
+    #[error("default output card is unavailable")]
+    DefaultCardUnavailable,
+
+    #[error("selected card '{0}' failed to list available output configs: '{1}'")]
+    OutputConfigsUnavailable(String, #[source] cpal::SupportedStreamConfigsError),
+
+    #[error("selected card '{0}' did not offer a compatible output config type, either due to hardware limitations or because it is currently in use")]
+    SupportedOutputUnavailable(String),
+
+    #[error("selected card '{0}' was unable to build an output stream: '{1}'")]
+    OutputStreamBuildError(String, #[source] cpal::BuildStreamError),
+
+    #[error("selected card '{0}' was unable to play an output stream: '{1}'")]
+    OutputStreamPlayError(String, #[source] cpal::PlayStreamError),
+}