1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! Error types and result alias for Allora.
//!
//! # Overview
//! The library uses a single enum [`Error`] to classify failures across
//! processors, routing, aggregation, serialization, and miscellaneous cases.
//! A crate-wide `Result<T>` type alias simplifies return signatures.
//!
//! # Goals
//! * Lightweight – no deep error type hierarchy.
//! * Human-friendly `Display` messages via `thiserror`.
//! * Extensible – new variants can be added in a non-breaking way (add to end).
//!
//! # When to Use Each Variant
//! * `Processor` – logic inside a processor failed (validation, transformation).
//! * `Routing` – route selection / content-based routing issues (no match, invalid path).
//! * `Aggregation` – aggregator state or completion failures.
//! * `Serialization` – encoding/decoding payload/header data.
//! * `Other` – fallback / miscellaneous; prefer creating a dedicated variant when patterns emerge.
//!
//! # Adding New Variants
//! Add at the end of the enum to avoid changing numeric discriminants (though they are
//! not relied upon externally). Provide a clear `#[error(...)]` message and (optionally)
//! a convenience constructor method.
//!
//! # Example
//! ```no_run
//! use allora_core::{Error, Result};
//! fn fallible() -> Result<()> { Err(Error::other("boom")) }
//! assert!(fallible().is_err());
//! ```
//! ```
//! use allora_core::{Result, Error};
//! fn do_work(ok: bool) -> Result<()> {
//! if ok { Ok(()) } else { Err(Error::processor("failed logic")) }
//! }
//! assert!(do_work(true).is_ok());
//! assert!(matches!(do_work(false), Err(Error::Processor(_))));
//! ```
//! ```rust
//! use allora_core::{Result, Error};
//! fn demo() -> Result<()> { Ok(()) }
//! ```
//! ```rust
//! use allora_core::{Result, Error};
//! fn demo() -> Result<()> { Ok(()) }
//! ```
use Error;
pub type Result<T, E = Error> = Result;