You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
482 B
27 lines
482 B
4 years ago
|
use std::fmt;
|
||
|
use serde::{
|
||
|
Serialize,
|
||
|
Deserialize
|
||
|
};
|
||
|
|
||
|
#[derive(Serialize, Deserialize, Clone)]
|
||
|
pub enum UError {
|
||
|
Raw(String)
|
||
|
}
|
||
|
|
||
|
impl UError {
|
||
|
pub fn description(&self) -> String {
|
||
|
match self {
|
||
|
UError::Raw(msg) => msg.clone()
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl fmt::Debug for UError {
|
||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||
|
let msg = match self {
|
||
|
UError::Raw(msg) => msg
|
||
|
};
|
||
|
write!(f, "{}", msg)
|
||
|
}
|
||
|
}
|