summaryrefslogtreecommitdiff
path: root/rola-utils/space-system/src/space/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rola-utils/space-system/src/space/error.rs')
-rw-r--r--rola-utils/space-system/src/space/error.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/rola-utils/space-system/src/space/error.rs b/rola-utils/space-system/src/space/error.rs
new file mode 100644
index 0000000..33ee6e4
--- /dev/null
+++ b/rola-utils/space-system/src/space/error.rs
@@ -0,0 +1,23 @@
+#[derive(thiserror::Error, Debug)]
+pub enum SpaceError {
+ #[error("Space not found")]
+ SpaceNotFound,
+
+ #[error("Path format error: {0}")]
+ PathFormatError(#[from] just_fmt::fmt_path::PathFormatError),
+
+ #[error("IO error: {0}")]
+ Io(#[from] std::io::Error),
+
+ #[error("Other: {0}")]
+ Other(String),
+}
+
+impl PartialEq for SpaceError {
+ fn eq(&self, other: &Self) -> bool {
+ match (self, other) {
+ (Self::Io(_), Self::Io(_)) => true,
+ _ => core::mem::discriminant(self) == core::mem::discriminant(other),
+ }
+ }
+}