Skip to main content

barbacane_compiler/spec_parser/
error.rs

1use thiserror::Error;
2
3/// Errors produced during spec parsing (E1001–E1004).
4#[derive(Debug, Error)]
5pub enum ParseError {
6    /// E1001: File is not valid OpenAPI 3.x or AsyncAPI 3.x.
7    #[error("E1001: not a valid OpenAPI 3.x or AsyncAPI 3.x spec")]
8    UnknownFormat,
9
10    /// E1002: YAML/JSON parse error.
11    #[error("E1002: parse error: {0}")]
12    ParseError(String),
13
14    /// E1003: Unresolved $ref.
15    #[error("E1003: unresolved $ref: {0}")]
16    UnresolvedRef(String),
17
18    /// E1004: Schema validation error.
19    #[error("E1004: schema validation error: {0}")]
20    SchemaError(String),
21
22    /// I/O error reading the spec file.
23    #[error("I/O error: {0}")]
24    Io(#[from] std::io::Error),
25}