Skip to main content

vobject/
error.rs

1use thiserror::Error;
2
3use crate::parser::ParseErrorReason;
4
5#[derive(Debug, Clone, Error)]
6pub enum VObjectError {
7    #[error("failed to parse: {}", source)]
8    Parse {
9        #[from]
10        source: ParseErrorReason,
11    },
12
13    #[error("Not a Vcard")]
14    NotAVCard,
15
16    #[error("Not a Icalendar: {}", _0)]
17    NotAnICalendar(String),
18
19    #[cfg(feature = "timeconversions")]
20    #[error("failed to parse time")]
21    ChronoError {
22        #[from]
23        source: chrono::format::ParseError,
24    },
25}
26
27pub(crate) type VObjectResult<T> = Result<T, VObjectError>;