Skip to main content

wickra_verify_core/
error.rs

1//! The single error type of the verify core.
2//!
3//! Every fallible entry point returns [`Result`]. The variants map one-to-one to
4//! the ways verification can fail before a verdict is even reached: a malformed
5//! claim, a malformed report, unusable data, or the backtest engine refusing to
6//! run. A *refuted* claim is **not** an error — that is a successful [`Verdict`]
7//! with `matches == false`.
8//!
9//! [`Verdict`]: crate::Verdict
10
11use thiserror::Error;
12
13/// The result of a wickra-verify-core operation.
14pub type Result<T> = std::result::Result<T, Error>;
15
16/// Everything that can go wrong while verifying a claim.
17#[derive(Debug, Error)]
18pub enum Error {
19    /// The claim could not be parsed or is internally inconsistent (unknown
20    /// field, missing strategy, empty dataset reference).
21    #[error("invalid claim: {0}")]
22    BadClaim(String),
23
24    /// The claimed report could not be parsed, serialized, or canonicalized.
25    #[error("invalid report: {0}")]
26    BadReport(String),
27
28    /// The referenced candle data is missing, empty, or does not match the
29    /// symbols the claim requires.
30    #[error("data error: {0}")]
31    Data(String),
32
33    /// The backtest engine refused to run on the given strategy and data.
34    #[error("backtest engine error: {0}")]
35    Backtest(String),
36
37    /// A command envelope (or its embedded JSON) could not be parsed.
38    #[error("parse error: {0}")]
39    Parse(String),
40}