Skip to main content

roasted_core/
error.rs

1
2pub trait Error {
3	fn name(&self) -> &'static str;
4	fn msg(&self) -> Option<String>;
5}
6
7pub enum CommonError {
8	StringError(&'static str)
9}
10
11impl Error for CommonError {
12	fn name(&self) -> &'static str {
13		match self {
14			CommonError::StringError(_) => { "string error" }
15		}
16	}
17	fn msg(&self) -> Option<String> {
18		match self {
19			CommonError::StringError(msg) => { return Some(msg.to_string()); }
20		}
21	}
22}
23