Skip to main content

verificar/
error.rs

1//! Error types for Verificar
2//!
3//! This module defines the error types used throughout the library.
4
5use thiserror::Error;
6
7/// Result type alias for Verificar operations
8pub type Result<T> = std::result::Result<T, Error>;
9
10/// Errors that can occur during Verificar operations
11#[derive(Error, Debug)]
12pub enum Error {
13    /// Grammar parsing error
14    #[error("grammar error: {0}")]
15    Grammar(String),
16
17    /// Code generation error
18    #[error("generation error: {0}")]
19    Generation(String),
20
21    /// AST mutation error
22    #[error("mutation error: {0}")]
23    Mutation(String),
24
25    /// Transpilation error
26    #[error("transpile error: {0}")]
27    Transpile(String),
28
29    /// Verification oracle error
30    #[error("verification error: {0}")]
31    Verification(String),
32
33    /// Execution timeout
34    #[error("execution timeout after {0}ms")]
35    Timeout(u64),
36
37    /// Runtime error during execution
38    #[error("runtime error in {phase}: {message}")]
39    Runtime {
40        /// Phase where error occurred (source or target)
41        phase: String,
42        /// Error message
43        message: String,
44    },
45
46    /// I/O error
47    #[error("io error: {0}")]
48    Io(#[from] std::io::Error),
49
50    /// Serialization error
51    #[error("serialization error: {0}")]
52    Serialization(String),
53
54    /// Configuration error
55    #[error("configuration error: {0}")]
56    Configuration(String),
57
58    /// Data pipeline error
59    #[error("data error: {0}")]
60    Data(String),
61}