aboutsummaryrefslogtreecommitdiff
path: root/games/rstnode/rst-client/src/error.rs
blob: 08266bd5e591567d540c9a98d8cb09bc02c57dc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 {}