oca_file/ocafile/
error.rs

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
29
use oca_file_semantics::ocafile::error::ParseError as SemanticsParseError;
use oca_file_transformation::ocafile::error::ParseError as TransformationParseError;

#[derive(thiserror::Error, Debug, serde::Serialize)]
#[serde(untagged)]
pub enum ParseError {
    #[error("Error at line {line_number} ({raw_line}): {message}")]
    GrammarError {
        #[serde(rename = "ln")]
        line_number: usize,
        #[serde(rename = "col")]
        column_number: usize,
        #[serde(rename = "c")]
        raw_line: String,
        #[serde(rename = "e")]
        message: String,
    },
    #[error("Error parsing meta: {0}")]
    MetaError(String),

    #[error("Error parsing semantics: {0}")]
    SemanticsError(#[from] SemanticsParseError),

    #[error("Error parsing transformation: {0}")]
    TransformationError(#[from] TransformationParseError),

    #[error("{0}")]
    Custom(String),
}