MASSIVE REFACTOR
This commit is contained in:
35
gamelog/src/error.rs
Normal file
35
gamelog/src/error.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
use std::{fmt, io};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum LogFileError {
|
||||
FailedToOpen(io::Error),
|
||||
RonSpannedError(ron::error::SpannedError),
|
||||
CompatibilityCheck(semver::Version),
|
||||
}
|
||||
|
||||
impl fmt::Display for LogFileError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::FailedToOpen(err) => write!(f, "{}", err),
|
||||
Self::CompatibilityCheck(ver) => write!(
|
||||
f,
|
||||
"GameLogs cannot be older than {}, but {} was found in logfile.",
|
||||
crate::MIN_VER.to_string(),
|
||||
ver.to_string()
|
||||
),
|
||||
Self::RonSpannedError(err) => write!(f, "{}", err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub enum DownError {
|
||||
NotKickoff,
|
||||
}
|
||||
|
||||
impl fmt::Display for DownError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
Self::NotKickoff => write!(f, "Variant was not Down::Kickoff."),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user