]> code.octet-stream.net Git - m17rt/blobdiff - m17app/src/error.rs
Add and test error if packet payload is too large
[m17rt] / m17app / src / error.rs
index f7079ca3ca8afe6cbe6a7e92c13285a91602760e..acbf397f28c1d4a6f247a59b6cf8e1c0833d0ab2 100644 (file)
@@ -1,10 +1,24 @@
 use thiserror::Error;
 
-#[derive(Debug, Error)]
+#[derive(Debug, Error, PartialEq, Eq, Clone)]
 pub enum M17Error {
     #[error("given callsign contains at least one character invalid in M17: {0}")]
     InvalidCallsignCharacters(char),
 
     #[error("given callsign is {0} characters long; maximum is 9")]
     CallsignTooLong(usize),
+
+    #[error("error during soundcard initialisation")]
+    SoundcardInit,
+
+    #[error("unable to locate sound card '{0}' - is it in use?")]
+    SoundcardNotFound(String),
+
+    #[error("unable to set up RTL-SDR receiver")]
+    RtlSdrInit,
+
+    #[error(
+        "provided packet payload is too large: provided {provided} bytes, capacity {capacity}"
+    )]
+    PacketTooLarge { provided: usize, capacity: usize },
 }