summaryrefslogtreecommitdiffstats
path: root/src/error.rs
blob: 8b01844d6454c64ff4b6f8d915f7c2741a85897a (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
25
26
27
use thiserror::Error;

use ::parser::ParseErrorReason;

#[derive(Debug, Clone, Error)]
pub enum VObjectError {
    #[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("failed to parse time")]
    ChronoError {
        #[from]
        source: chrono::format::ParseError,
    },
}

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