1use std::fmt;
2
3#[derive(Debug)]
4pub enum PoaError {
5 EmptyInput,
6 InsufficientDepth {
7 got: usize,
8 min: usize,
9 },
10 SeedOutOfBounds {
11 index: usize,
12 len: usize,
13 },
14 BandTooNarrow {
15 configured: usize,
16 required: usize,
17 },
18 NoSpanningReads {
23 left_depth: usize,
24 right_depth: usize,
25 },
26}
27
28impl fmt::Display for PoaError {
29 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
30 match self {
31 PoaError::EmptyInput => {
32 write!(f, "no reads provided")
33 }
34 PoaError::InsufficientDepth { got, min } => {
35 write!(
36 f,
37 "insufficient depth: got {got} reads, need at least {min}"
38 )
39 }
40 PoaError::SeedOutOfBounds { index, len } => {
41 write!(f, "seed index {index} is out of bounds for {len} reads")
42 }
43 PoaError::BandTooNarrow {
44 configured,
45 required,
46 } => {
47 write!(
48 f,
49 "band width {configured} too narrow; estimated {required} required — \
50 retry with a wider band or enable adaptive_band"
51 )
52 }
53 PoaError::NoSpanningReads {
54 left_depth,
55 right_depth,
56 } => {
57 write!(
58 f,
59 "no spanning reads found: {left_depth} left-only and {right_depth} \
60 right-only reads detected — use bridged_consensus to assemble each \
61 side separately"
62 )
63 }
64 }
65 }
66}
67
68impl std::error::Error for PoaError {}