Skip to main content

rustcv_core/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum CameraError {
5    #[error("Device disconnected: {0}")]
6    Disconnected(String),
7
8    #[error("USB Bandwidth exceeded. Suggested action: {suggestion}")]
9    BandwidthExceeded {
10        required_mbps: u32,
11        limit_mbps: u32,
12        suggestion: String,
13    },
14
15    #[error("Device busy: Exclusive access required")]
16    DeviceBusy,
17
18    #[error("Frame dropped due to ring buffer overflow")]
19    BufferOverflow,
20
21    #[error("Format negotiation failed: No hardware support for requested constraints")]
22    FormatNotSupported,
23
24    #[error("Simulation backend error: {0}")]
25    SimulationError(String),
26
27    #[error("Backend error: {0}")]
28    BackendError(String),
29
30    #[error(transparent)]
31    Io(#[from] std::io::Error),
32}
33
34pub type Result<T> = std::result::Result<T, CameraError>;