1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::fmt::Display;
use super::*;
impl From<ParseIntError> for VosError {
fn from(error: ParseIntError) -> Self {
Self::parse_error(error.to_string())
}
}
impl From<ParseFloatError> for VosError {
fn from(error: ParseFloatError) -> Self {
Self::parse_error(error.to_string())
}
}
impl VosError {
pub fn parse_error<S>(msg: S) -> Self
where
S: Display,
{
Self {
kind: Box::new(VosErrorKind::ParseError(msg.to_string())),
level: DiagnosticLevel::Error,
file: Default::default(),
}
}
}