use miette::Diagnostic;
use thiserror::Error;
#[derive(Error, Diagnostic, Debug, PartialEq, Eq)]
pub enum MionParameterAPIError {
#[error(
"The MION Parameter body you passed in was: {0} bytes long, but must be exactly 512 bytes long!"
)]
#[diagnostic(code(cat_dev::api::mion::parameter::body_incorrect_length))]
BodyNotCorrectLength(usize),
#[error("The MION Parameter name: {0} is not known, cannot find index.")]
#[diagnostic(code(cat_dev::api::mion::parameter::name_not_known))]
NameNotKnown(String),
#[error(
"You asked for the MION Parameter at index: {0}, but MION Parameter indexes cannot be greater than 511."
)]
#[diagnostic(code(cat_dev::api::mion::parameter::not_in_range))]
NotInRange(usize),
}
#[derive(Error, Diagnostic, Debug, PartialEq, Eq)]
pub enum MionParamProtocolError {
#[error("Error code received from MION Params: `{0}`")]
#[diagnostic(code(cat_dev::net::parse::mion::params::error_code))]
ErrorCode(i32),
#[error(
"Unknown Packet Type: `{0}` received from the network (this may mean your CAT-DEV is doing something we didn't expect)"
)]
#[diagnostic(code(cat_dev::net::parse::mion::params::unknown_packet_type))]
PacketType(i32),
}