wesley_core/domain/error.rs
1//! Domain error types.
2
3use serde::{Deserialize, Serialize};
4use thiserror::Error;
5
6/// Core error types for Wesley.
7#[derive(Error, Debug, Serialize, Deserialize, Clone, PartialEq)]
8pub enum WesleyError {
9 /// Error during parsing of GraphQL SDL.
10 #[error("Parse error: {message}")]
11 ParseError {
12 /// Human-readable error message.
13 message: String,
14 /// Line number (if available).
15 line: Option<u32>,
16 /// Column number (if available).
17 column: Option<u32>,
18 },
19 /// Error during lowering from AST to IR.
20 #[error("Lowering error: {message} in {area}")]
21 LoweringError {
22 /// Human-readable error message.
23 message: String,
24 /// The area of the compiler where the error occurred (e.g. "table", "field").
25 area: String,
26 },
27 /// Error from a resilience policy (e.g. timeout, max retries).
28 #[error("Resilience error: {0}")]
29 ResilienceError(String),
30}
31
32/// A diagnostic message emitted by the compiler.
33#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
34pub struct WesleyDiagnostic {
35 /// Machine-readable error code.
36 pub code: String,
37 /// Human-readable error message.
38 pub message: String,
39 /// Severity level (e.g. "ERROR", "WARNING").
40 pub severity: String,
41 /// Line number (if available).
42 pub line: Option<u32>,
43 /// Column number (if available).
44 pub column: Option<u32>,
45}