1use logit_loom_core::{CallbackFailure, CoreError};
6use thiserror::Error;
7
8#[derive(Clone, Debug, PartialEq, Eq, Error)]
10#[error("{message}")]
11pub struct TransformError {
12 message: String,
13}
14
15impl TransformError {
16 pub fn new(message: impl Into<String>) -> Self {
18 Self {
19 message: message.into(),
20 }
21 }
22}
23
24#[derive(Clone, Debug, PartialEq, Eq, Error)]
26#[error("{message}")]
27pub struct ObserverError {
28 message: String,
29}
30
31impl ObserverError {
32 pub fn new(message: impl Into<String>) -> Self {
34 Self {
35 message: message.into(),
36 }
37 }
38}
39
40#[derive(Clone, Debug, PartialEq, Eq, Error)]
42#[error("{message}")]
43pub struct PrefillObserverError {
44 message: String,
45}
46
47impl PrefillObserverError {
48 pub fn new(message: impl Into<String>) -> Self {
50 Self {
51 message: message.into(),
52 }
53 }
54}
55
56#[non_exhaustive]
58#[derive(Debug, Error)]
59pub enum PipelineError {
60 #[error(transparent)]
62 Contract(#[from] CoreError),
63 #[error("pipeline has not begun")]
65 NotBegun,
66 #[error("pipeline is failed; call begin before reuse")]
68 Failed,
69 #[error("invalid transform step {actual}; expected {expected}")]
71 InvalidStep {
72 expected: u32,
74 actual: u32,
76 },
77 #[error("token admission has no unmatched successful transform invocation")]
79 UnexpectedAdmission,
80 #[error("previous transform invocation is still awaiting causal admission")]
82 AdmissionPending,
83 #[error("invalid candidate view: {0}")]
85 InvalidCandidates(String),
86 #[error("pipeline accounting overflowed: {0}")]
88 AccountingOverflow(&'static str),
89 #[error("transform stage {stage} failed: {failure:?}")]
91 Callback {
92 stage: usize,
94 failure: CallbackFailure,
96 },
97}