Skip to main content

spikard_codegen/
error.rs

1//! Error types for code generation
2
3use std::io;
4use thiserror::Error;
5
6/// Result type for codegen operations
7pub type Result<T> = std::result::Result<T, CodegenError>;
8
9/// Error types for code generation operations
10#[derive(Error, Debug)]
11pub enum CodegenError {
12    #[error("IO error: {0}")]
13    IoError(#[from] io::Error),
14
15    #[error("JSON error: {0}")]
16    JsonError(#[from] serde_json::Error),
17
18    #[error("Serialization error: {0}")]
19    SerializationError(String),
20
21    #[error("Invalid fixture: {0}")]
22    InvalidFixture(String),
23
24    #[error("Invalid schema: {0}")]
25    InvalidSchema(String),
26
27    #[error("Invalid SQL annotation at line {line}: {message}")]
28    InvalidSqlAnnotation { line: usize, message: String },
29
30    #[error("Unsupported SQL command for HTTP: {command} cannot be mapped to an HTTP route")]
31    UnsupportedSqlCommand { command: String },
32}