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