aboutsummaryrefslogtreecommitdiff
path: root/stockton-levels
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:23 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:23 +0100
commitc52a05e6d3977efce6bd4479aa312dc90e0452e5 (patch)
treec383c910c1467b406e332651906e081c599d6951 /stockton-levels
parentd5b9ccd3d4a6e5b35a0411688bfb7113f5c7d631 (diff)
feat(render): proper error handling
Diffstat (limited to 'stockton-levels')
-rw-r--r--stockton-levels/Cargo.toml3
-rw-r--r--stockton-levels/src/types.rs6
2 files changed, 7 insertions, 2 deletions
diff --git a/stockton-levels/Cargo.toml b/stockton-levels/Cargo.toml
index d39b8d4..2cae877 100644
--- a/stockton-levels/Cargo.toml
+++ b/stockton-levels/Cargo.toml
@@ -10,4 +10,5 @@ edition = "2018"
[dependencies]
nalgebra = "^0.20"
bitflags = "^1.2"
-bitvec = "0.17" \ No newline at end of file
+thiserror = "1.0.25"
+bitvec = "0.17"
diff --git a/stockton-levels/src/types.rs b/stockton-levels/src/types.rs
index 7cc4671..dd42a5e 100644
--- a/stockton-levels/src/types.rs
+++ b/stockton-levels/src/types.rs
@@ -1,6 +1,7 @@
//! Various types used in parsed BSP files.
use std::convert::TryInto;
+use thiserror::Error;
/// RGBA Colour (0-255)
#[derive(Debug, Clone, Copy, PartialEq)]
@@ -65,10 +66,13 @@ impl Rgb {
}
}
-#[derive(Debug)]
+#[derive(Error, Debug)]
/// An error encountered while parsing.
pub enum ParseError {
+ #[error("Unsupported format")]
Unsupported,
+
+ #[error("Invalid file")]
Invalid,
}