#[derive(Clone, Debug, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum CoreError {
#[error("{0}")]
Invalid(&'static str),
#[error("version {found} is newer than {latest}")]
UnsupportedVersion {
found: u32,
latest: u32,
},
#[error("{0}")]
Io(String),
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn errors_are_send_sync_and_static() {
fn assert_impl<T: Send + Sync + 'static>() {}
assert_impl::<CoreError>();
assert_eq!(
CoreError::UnsupportedVersion { found: 2, latest: 1 }.to_string(),
"version 2 is newer than 1"
);
}
}