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
546 B
27 lines
546 B
use std::error::Error;
|
|
use std::fmt;
|
|
|
|
/// Errors that may be emitted by the command parser
|
|
#[derive(Debug)]
|
|
pub enum ParserError {
|
|
/// No command provided
|
|
Empty,
|
|
|
|
/// Unknown command
|
|
Unknown,
|
|
|
|
Default,
|
|
}
|
|
|
|
impl fmt::Display for ParserError {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
Self::Empty => fmt::Display::fmt("No command provided", f),
|
|
Self::Unknown => fmt::Display::fmt("Unknown command", f),
|
|
Self::Default => fmt::Display::fmt("Unknown command", f),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Error for ParserError {}
|