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 crate::resolve::ResolverError;
use fluent_syntax::parser::ParserError;

#[derive(Debug, Fail, PartialEq)]
pub enum FluentError {
    #[fail(display = "attempted to override an existing {}: {}", kind, id)]
    Overriding { kind: &'static str, id: String },
    #[fail(display = "Parser error")]
    ParserError(ParserError),
    #[fail(display = "Resolver error")]
    ResolverError(ResolverError),
}

impl From<ResolverError> for FluentError {
    fn from(error: ResolverError) -> Self {
        FluentError::ResolverError(error)
    }
}

impl From<ParserError> for FluentError {
    fn from(error: ParserError) -> Self {
        FluentError::ParserError(error)
    }
}