mirror of
https://github.com/storytold/bevy-mocap.git
synced 2026-10-09 00:09:45 +00:00
better errors
This commit is contained in:
+15
-1
@@ -26,7 +26,21 @@ pub enum CSVParseError {
|
||||
|
||||
impl std::fmt::Display for CSVParseError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(&format!("{self:?}"))
|
||||
match self {
|
||||
CSVParseError::NoData => f.write_str("Empty CSV File"),
|
||||
CSVParseError::InvalidCSV(e) => f.write_str(&format!("Invalid CSV: {e}")),
|
||||
CSVParseError::NoMorphs => f.write_str("No Morphs Available in the CSV File"),
|
||||
CSVParseError::MisssingKnownHeaders => {
|
||||
f.write_str("No Timestamp or Morph Count Headers")
|
||||
}
|
||||
CSVParseError::NoFrames => f.write_str("The CSV has 0 frames"),
|
||||
CSVParseError::TimecodeParseError(e) => {
|
||||
f.write_str(&format!("Couldn't parse a timecode in the CSV: {e}"))
|
||||
}
|
||||
CSVParseError::MorphParseError(e) => f.write_str(&format!(
|
||||
"Couldn't parse a morph in the CSV - is it not a floating point number?: {e}"
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-1
@@ -23,7 +23,15 @@ pub enum TimestampParseError {
|
||||
|
||||
impl std::fmt::Display for TimestampParseError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(&format!("{self:?}"))
|
||||
match self {
|
||||
TimestampParseError::EmptyTimestamp => f.write_str("The timestamp is an empty string"),
|
||||
TimestampParseError::TooManySegments => {
|
||||
f.write_str("There are too many segments in the timestamp")
|
||||
}
|
||||
TimestampParseError::NumberParseError(e, s) => f.write_str(&format!(
|
||||
"Couldn't parse one of the segments - is {s} a number?: {e}"
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+23
-1
@@ -40,7 +40,29 @@ pub enum CSVAnimationLoaderError {
|
||||
|
||||
impl std::fmt::Display for CSVAnimationLoaderError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(&format!("{self:?}"))
|
||||
match self {
|
||||
CSVAnimationLoaderError::Io(e) => {
|
||||
f.write_str(&format!("Error accessing the CSV animation files: {e}"))
|
||||
}
|
||||
CSVAnimationLoaderError::CSVParseError(e) => {
|
||||
f.write_str(&format!("Failed to parse the CSV file: {e}"))
|
||||
}
|
||||
CSVAnimationLoaderError::ClipInfoParseError(e) => {
|
||||
f.write_str(&format!("Couldn't parse Clip Info file: {e}"))
|
||||
}
|
||||
CSVAnimationLoaderError::CSVReadBytesError(e) => {
|
||||
f.write_str(&format!("Error while reading the CSV file: {e}"))
|
||||
}
|
||||
CSVAnimationLoaderError::CSVStringError(e) => f.write_str(&format!(
|
||||
"Couldn't process CSV file - is it encoded as Utf8? {e}"
|
||||
)),
|
||||
CSVAnimationLoaderError::MappingReadBytesError(e) => {
|
||||
f.write_str(&format!("Couldn't read mapping file: {e}"))
|
||||
}
|
||||
CSVAnimationLoaderError::MappingParseError(e) => {
|
||||
f.write_str(&format!("Failed to parse mapping file: {e}"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user