Files
rustytorch/crates/specialized/rtx-neuro-lsl/src/error.rs
T
2026-03-04 00:08:42 +00:00

47 lines
1.3 KiB
Rust

//! Error types for LSL operations
use thiserror::Error;
/// Errors that can occur during LSL operations
#[derive(Debug, Error)]
pub enum LslError {
/// Stream not found during discovery
#[error("Stream not found: {name}")]
StreamNotFound { name: String },
/// Connection failed
#[error("Failed to connect to stream: {message}")]
ConnectionFailed { message: String },
/// Stream disconnected unexpectedly
#[error("Stream disconnected: {stream_id}")]
Disconnected { stream_id: String },
/// Timeout waiting for samples
#[error("Timeout waiting for samples")]
Timeout,
/// Invalid stream configuration
#[error("Invalid stream configuration: {message}")]
InvalidConfig { message: String },
/// Buffer overflow - samples lost
#[error("Buffer overflow: {lost} samples lost")]
BufferOverflow { lost: usize },
/// Native LSL library not available
#[error("Native LSL library not available. Install liblsl and rebuild with 'native' feature.")]
NativeNotAvailable,
/// Channel send error
#[error("Channel send error: {0}")]
ChannelSend(String),
/// I/O error
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
}
/// Result type for LSL operations
pub type Result<T> = std::result::Result<T, LslError>;