src/global/structs/errors.rs
21 lines · 572 bytes
1use std::{error::Error, fmt::Display};
2
3/// Errors for displaying custom string in the message bar if there is an error
4#[derive(Debug)]
5pub enum Errors {
6 BlankError,
7 StringError(String),
8 StrError(&'static str),
9}
10
11impl Display for Errors {
12 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13 match self {
14 Self::BlankError => f.write_str("Is a blank error ¯\\_(ツ)_/¯"),
15 Self::StringError(e) => f.write_str(e),
16 Self::StrError(e) => f.write_str(e),
17 }
18 }
19}
20
21impl Error for Errors {}