uni_query/query/df_graph/
locy_errors.rs1use std::fmt;
7
8#[derive(Debug)]
10pub enum LocyRuntimeError {
11 NonConvergence { iterations: usize },
13 MonotonicViolation { rule: String, column: String },
15 NegationCycle { rules: Vec<String> },
17 MemoryLimitExceeded {
19 rule: String,
20 bytes: usize,
21 limit: usize,
22 },
23}
24
25impl fmt::Display for LocyRuntimeError {
26 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27 match self {
28 Self::NonConvergence { iterations } => {
29 write!(
30 f,
31 "fixpoint did not converge: max iterations ({iterations}) exceeded"
32 )
33 }
34 Self::MonotonicViolation { rule, column } => {
35 write!(f, "monotonic violation in rule '{rule}', column '{column}'")
36 }
37 Self::NegationCycle { rules } => {
38 write!(
39 f,
40 "negation cycle detected among rules: {}",
41 rules.join(", ")
42 )
43 }
44 Self::MemoryLimitExceeded { rule, bytes, limit } => {
45 write!(
46 f,
47 "rule '{rule}' exceeded memory limit ({bytes} bytes > {limit} byte limit)"
48 )
49 }
50 }
51 }
52}
53
54impl std::error::Error for LocyRuntimeError {}