cat_dev/mion/proto/parameter/
errors.rs1use miette::Diagnostic;
4use thiserror::Error;
5
6#[derive(Error, Diagnostic, Debug, PartialEq, Eq)]
7pub enum MIONParameterAPIError {
8 #[error("The MION Parameter body you passed in was: {0} bytes long, but must be exactly 512 bytes long!")]
11 #[diagnostic(code(cat_dev::api::mion::parameter::body_incorrect_length))]
12 BodyNotCorrectLength(usize),
13 #[error("The MION Parameter name: {0} is not known, cannot find index.")]
22 #[diagnostic(code(cat_dev::api::mion::parameter::name_not_known))]
23 NameNotKnown(String),
24 #[error("You asked for the MION Parameter at index: {0}, but MION Parameter indexes cannot be greater than 511.")]
29 #[diagnostic(code(cat_dev::api::mion::parameter::not_in_range))]
30 NotInRange(usize),
31}
32
33#[derive(Error, Diagnostic, Debug, PartialEq, Eq)]
34pub enum MIONParamProtocolError {
35 #[error("Error code received from MION Params: `{0}`")]
41 #[diagnostic(code(cat_dev::net::parse::mion::params::error_code))]
42 ErrorCode(i32),
43 #[error("Unknown Packet Type: `{0}` received from the network (this may mean your CAT-DEV is doing something we didn't expect)")]
45 #[diagnostic(code(cat_dev::net::parse::mion::params::unknown_packet_type))]
46 PacketType(i32),
47}