use thiserror::Error;
#[allow(dead_code)]
#[derive(Debug, Error)]
pub enum RouteError {
#[error("graph is empty — no nodes available for optimization")]
EmptyGraph,
#[error("missing edge from node {from} to node {to}")]
MissingEdge {
from: usize,
to: usize,
},
#[error(
"graph is not Eulerian: node {node_id} has in-degree {in_degree} and out-degree {out_degree}"
)]
NotEulerian {
node_id: String,
in_degree: usize,
out_degree: usize,
},
#[error("graph has no strongly connected components")]
NoStronglyConnectedComponent,
#[error("malformed route data at node {node_id}: {reason}")]
MalformedRouteData {
node_id: String,
reason: String,
},
#[error("network timeout communicating with {peer}: elapsed {elapsed:?}")]
NetworkTimeout {
peer: String,
elapsed: std::time::Duration,
},
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("Lean 4 FFI error: {0}")]
FfiError(String),
#[error("serialization error: {0}")]
SerializationError(String),
#[error("routing error: {0}")]
Other(String),
}
#[allow(dead_code)]
const _: () = {
fn assert_send_sync<T: Send + Sync>() {}
fn _route_error_is_send_sync() {
assert_send_sync::<RouteError>();
}
};