1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use std::{error::Error, fmt::{self, Display}};

#[derive(Debug)]
pub enum InputError {
	Typed(String),
	Completed(String, usize),
	Canceled(String),
}

impl Display for InputError {
	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
		match self {
			Self::Typed(text) => write!(f, "Typed error: {text}"),
			Self::Completed(text, _) => write!(f, "Completed error: {text}"),
			Self::Canceled(text) => write!(f, "Canceled error: {text}"),
		}
	}
}

impl Error for InputError {}