1pub use crate::continuation::error::*;
4
5#[derive(Copy, Clone, Debug, thiserror::Error)]
10pub enum Error {
11 #[error("deadlock detected")]
13 Deadlock,
14 #[error(transparent)]
16 NotBorn(#[from] NotBorn),
17 #[error(transparent)]
19 NotIdle(#[from] NotIdle),
20 #[error(transparent)]
22 NotBusy(#[from] NotBusy),
23 #[error(transparent)]
25 NotNext(#[from] NotNext),
26 #[error(transparent)]
28 NotDone(#[from] NotDone),
29 #[error(transparent)]
31 NotGone(#[from] NotGone),
32 #[error(transparent)]
34 NotInit(#[from] NotInit),
35 #[error(transparent)]
37 NotTerm(#[from] NotTerm),
38 #[error("causality error")]
40 Causality,
41}
42
43#[derive(Copy, Clone, Debug, thiserror::Error)]
47pub struct Deadlock<T>(pub T);
48
49impl<T> From<Deadlock<T>> for Error {
50 fn from(_: Deadlock<T>) -> Self {
51 Error::Deadlock
52 }
53}
54
55impl<T: crate::config::Time> core::fmt::Display for Deadlock<T> {
56 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
57 write!(f, "deadlock detected at {}", self.0.display())
58 }
59}
60
61#[derive(Copy, Clone, Debug, thiserror::Error)]
64#[error(
65 "continuation was scheduled at model-time {cause:?} (cause) for model-time \
66 {effect:?} (effect), violating causality"
67)]
68pub struct CausalityError<T> {
69 pub cause: T,
71 pub effect: T,
73}
74
75impl<T> From<CausalityError<T>> for Error {
76 fn from(_: CausalityError<T>) -> Self {
77 Error::Causality
78 }
79}