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(
11 "The MION Parameter body you passed in was: {0} bytes long, but must be exactly 512 bytes long!"
12 )]
13 #[diagnostic(code(cat_dev::api::mion::parameter::body_incorrect_length))]
14 BodyNotCorrectLength(usize),
15 #[error("The MION Parameter name: {0} is not known, cannot find index.")]
24 #[diagnostic(code(cat_dev::api::mion::parameter::name_not_known))]
25 NameNotKnown(String),
26 #[error(
31 "You asked for the MION Parameter at index: {0}, but MION Parameter indexes cannot be greater than 511."
32 )]
33 #[diagnostic(code(cat_dev::api::mion::parameter::not_in_range))]
34 NotInRange(usize),
35}
36
37#[derive(Error, Diagnostic, Debug, PartialEq, Eq)]
38pub enum MionParamProtocolError {
39 #[error("Error code received from MION Params: `{0}`")]
45 #[diagnostic(code(cat_dev::net::parse::mion::params::error_code))]
46 ErrorCode(i32),
47 #[error(
49 "Unknown Packet Type: `{0}` received from the network (this may mean your CAT-DEV is doing something we didn't expect)"
50 )]
51 #[diagnostic(code(cat_dev::net::parse::mion::params::unknown_packet_type))]
52 PacketType(i32),
53}