aboutsummaryrefslogtreecommitdiff
path: root/games/rstnode/rst-client/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'games/rstnode/rst-client/src/error.rs')
-rw-r--r--games/rstnode/rst-client/src/error.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/games/rstnode/rst-client/src/error.rs b/games/rstnode/rst-client/src/error.rs
new file mode 100644
index 000000000000..08266bd5e591
--- /dev/null
+++ b/games/rstnode/rst-client/src/error.rs
@@ -0,0 +1,24 @@
+//! Various errors that can occur
+
+use std::{
+ error::Error,
+ fmt::{self, Display, Formatter},
+};
+
+/// Error loading an asset
+#[derive(Clone, Debug)]
+pub struct LoadError(String);
+
+impl<'s> From<&'s str> for LoadError {
+ fn from(s: &'s str) -> Self {
+ Self(s.into())
+ }
+}
+
+impl Display for LoadError {
+ fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ write!(f, "{}", self.0)
+ }
+}
+
+impl Error for LoadError {}