22 lines
735 B
Rust
22 lines
735 B
Rust
|
use std::fmt;
|
||
|
|
||
|
/// An error that happenned when creating a nettext encoder term
|
||
|
#[derive(Debug)]
|
||
|
pub enum Error {
|
||
|
InvalidCharacter(u8),
|
||
|
InvalidRaw,
|
||
|
NotADictionnary,
|
||
|
ListInList,
|
||
|
}
|
||
|
|
||
|
impl std::fmt::Display for Error {
|
||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||
|
match self {
|
||
|
Error::InvalidCharacter(c) => write!(f, "Invalid character '{}'", *c as char),
|
||
|
Error::InvalidRaw => write!(f, "Invalid RAW nettext litteral"),
|
||
|
Error::NotADictionnary => write!(f, "Tried to insert into a term that isn't a dictionnary"),
|
||
|
Error::ListInList => write!(f, "Refusing to build nested lists with list(), use either list_flatten() or list_nested()"),
|
||
|
}
|
||
|
}
|
||
|
}
|