tp_lib_core/detections/
error.rs1use chrono::{DateTime, FixedOffset};
6use thiserror::Error;
7
8#[derive(Debug, Error)]
14pub enum DetectionError {
15 #[error("unsupported detections file extension: {0:?}")]
17 UnsupportedExtension(String),
18
19 #[error("invalid detections schema: {0}")]
21 InvalidSchema(String),
22
23 #[error("detection parse error at {source_file}:{source_row}: {message}")]
25 Parse {
26 source_file: String,
27 source_row: usize,
28 message: String,
29 },
30
31 #[error("invalid timestamp at {source_file}:{source_row}: {message}")]
33 InvalidTimestamp {
34 source_file: String,
35 source_row: usize,
36 message: String,
37 },
38
39 #[error("invalid intrinsic value {value} at {source_file}:{source_row} (must be in [0, 1])")]
41 InvalidIntrinsic {
42 source_file: String,
43 source_row: usize,
44 value: f64,
45 },
46
47 #[error(
49 "missing crs at {source_file}:{source_row}: coordinate detections require an explicit CRS"
50 )]
51 MissingCrs {
52 source_file: String,
53 source_row: usize,
54 },
55
56 #[error(
58 "conflicting detections at {timestamp}: netelement '{netelement_a}' vs '{netelement_b}'"
59 )]
60 ConflictingDetections {
61 timestamp: DateTime<FixedOffset>,
62 netelement_a: String,
63 netelement_b: String,
64 },
65
66 #[error(
68 "invalid time range at {source_file}:{source_row}: t_from ({t_from}) is after t_to ({t_to})"
69 )]
70 InvalidTimeRange {
71 source_file: String,
72 source_row: usize,
73 t_from: DateTime<FixedOffset>,
74 t_to: DateTime<FixedOffset>,
75 },
76
77 #[error("unknown netelement '{netelement_id}' at {source_file}:{source_row}")]
79 UnknownNetelement {
80 source_file: String,
81 source_row: usize,
82 netelement_id: String,
83 },
84
85 #[error("duplicate resolution for detection at {source_file}:{source_row}")]
87 DuplicateResolution {
88 source_file: String,
89 source_row: usize,
90 },
91
92 #[error("detection IO error: {0}")]
94 Io(#[from] std::io::Error),
95}