use thiserror::Error;
pub use codec_proto::generated::proto::reallyme::codec::v1::CodecGeneralCborErrorReason as ErrorReason;
#[derive(Clone, Copy, Debug, Eq, Error, PartialEq)]
#[error("general CBOR: {reason}")]
pub struct CborError {
reason: ErrorReason,
}
impl CborError {
#[must_use]
pub const fn new(reason: ErrorReason) -> Self {
Self { reason }
}
#[must_use]
pub const fn reason(self) -> ErrorReason {
self.reason
}
}
pub(super) const fn error(reason: ErrorReason) -> CborError {
CborError::new(reason)
}