synapse_models/
error.rs

1//! Error types for synapse models library.
2
3use thiserror::Error;
4
5/// Errors that can occur in synaptic operations.
6#[derive(Error, Debug, Clone, PartialEq)]
7pub enum SynapseError {
8    /// Invalid synaptic weight value.
9    #[error("Invalid synaptic weight: {0}. Expected value in range [{1}, {2}]")]
10    InvalidWeight(f64, f64, f64),
11
12    /// Invalid time constant.
13    #[error("Invalid time constant: {0}. Must be positive")]
14    InvalidTimeConstant(f64),
15
16    /// Invalid delay value.
17    #[error("Invalid delay: {0}. Must be non-negative")]
18    InvalidDelay(f64),
19
20    /// Invalid probability value.
21    #[error("Invalid probability: {0}. Must be in range [0, 1]")]
22    InvalidProbability(f64),
23
24    /// Invalid voltage value.
25    #[error("Invalid voltage: {0} mV")]
26    InvalidVoltage(f64),
27
28    /// Invalid concentration value.
29    #[error("Invalid concentration: {0}. Must be non-negative")]
30    InvalidConcentration(f64),
31
32    /// Synapse not found in network.
33    #[error("Synapse not found: {0}")]
34    SynapseNotFound(usize),
35
36    /// Neuron not found in network.
37    #[error("Neuron not found: {0}")]
38    NeuronNotFound(usize),
39
40    /// Invalid network configuration.
41    #[error("Invalid network configuration: {0}")]
42    InvalidNetwork(String),
43
44    /// Numerical integration error.
45    #[error("Numerical integration error: {0}")]
46    IntegrationError(String),
47}
48
49/// Result type for synapse operations.
50pub type Result<T> = std::result::Result<T, SynapseError>;