1use std::fmt;
2use std::error::Error;
3
4#[derive(Debug)]
5pub struct UltraNLPError {
6 message: String,
7}
8
9impl UltraNLPError {
10 pub fn new<T: AsRef<str>>(message: T) -> Self {
11 let message = message
12 .as_ref()
13 .to_string();
14
15 Self { message }
16 }
17}
18
19impl fmt::Display for UltraNLPError {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 write!(f, "{}", self.message)
22 }
23}
24
25impl Error for UltraNLPError {}
26
27pub type UltraNLPResult<T, E = UltraNLPError> = Result<T, E>;