summaryrefslogtreecommitdiffstats
path: root/src/error.rs
blob: 13c268da20c167566eee5e0ec6caf303576b4ca0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use thiserror::Error;

use ::parser::ParseErrorReason;

#[derive(Debug, Clone, Error)]
pub enum VObjectErrorKind {
    #[error("failed to parse: {}", source)]
    Parse {
        #[from]
        source: ParseErrorReason,
    },

    #[error("Not a Vcard")]
    NotAVCard,

    #[error("Not a Icalendar: {}", _0)]
    NotAnICalendar(String),

    #[cfg(feature = "timeconversions")]
    #[error("{}", _0)]
    ChronoError(::chrono::format::ParseError),
}

pub(crate) type VObjectResult<T> = Result<T, VObjectErrorKind>;