argumentation_weighted_bipolar/error.rs
1//! Crate error types.
2
3use thiserror::Error;
4
5/// Errors that can occur in the `argumentation-weighted-bipolar` crate.
6#[derive(Debug, Error)]
7pub enum Error {
8 /// An edge weight was non-finite or negative. Mirrors the rule in
9 /// `argumentation-weighted`: weights must be non-negative finite.
10 #[error("invalid edge weight {weight}: weights must be non-negative finite f64")]
11 InvalidWeight {
12 /// The weight that failed validation.
13 weight: f64,
14 },
15
16 /// A budget value was non-finite or negative.
17 #[error("invalid budget {budget}: budgets must be non-negative finite f64")]
18 InvalidBudget {
19 /// The budget that failed validation.
20 budget: f64,
21 },
22
23 /// A framework had more edges (attacks + supports) than the exact
24 /// Dunne 2011 subset enumeration can handle in finite time.
25 #[error("too many edges for exact enumeration: {edges} exceeds limit of {limit}")]
26 TooManyEdges {
27 /// The total edge count.
28 edges: usize,
29 /// The current enumeration limit.
30 limit: usize,
31 },
32
33 /// A support edge was added that made an argument support itself.
34 #[error("illegal self-support: argument cannot be its own necessary supporter")]
35 IllegalSelfSupport,
36
37 /// An error propagated from `argumentation-bipolar`.
38 #[error("bipolar error: {0}")]
39 Bipolar(#[from] argumentation_bipolar::Error),
40
41 /// An error propagated from the core Dung layer.
42 #[error("dung error: {0}")]
43 Dung(#[from] argumentation::Error),
44}