pub enum PropertyError {
ReadLockError {
context: String,
},
WriteLockError {
context: String,
},
ObserverNotFound {
id: usize,
},
PoisonedLock,
ObserverError {
reason: String,
},
ThreadPoolExhausted,
InvalidConfiguration {
reason: String,
},
PersistenceError {
reason: String,
},
NoHistory {
reason: String,
},
ValidationError {
reason: String,
},
}Expand description
Errors that can occur when working with ObservableProperty
§Note on Lock Poisoning
This implementation uses graceful degradation for poisoned locks. When a lock
is poisoned (typically due to a panic in an observer or another thread), the
library automatically recovers the inner value using PoisonError::into_inner().
This means:
- All operations continue to work even after a lock is poisoned
- No
ReadLockError,WriteLockError, orPoisonedLockerrors will occur in practice - The system remains operational and observers continue to function
The error variants are kept for backward compatibility and potential future use cases, but with the current implementation, poisoned locks are transparent to users.
§Production Benefit
This approach ensures maximum availability and resilience in production systems where a misbehaving observer shouldn’t bring down the entire property system.
Variants§
ReadLockError
Failed to acquire a read lock on the property
Note: With graceful degradation, this error is unlikely to occur in practice as poisoned locks are automatically recovered.
WriteLockError
Failed to acquire a write lock on the property
Note: With graceful degradation, this error is unlikely to occur in practice as poisoned locks are automatically recovered.
ObserverNotFound
Attempted to unsubscribe an observer that doesn’t exist
PoisonedLock
The property’s lock has been poisoned due to a panic in another thread
Note: With graceful degradation, this error will not occur in practice as the implementation automatically recovers from poisoned locks.
ObserverError
An observer function encountered an error during execution
ThreadPoolExhausted
The thread pool for async notifications is exhausted
InvalidConfiguration
Invalid configuration was provided
PersistenceError
Failed to persist the property value
NoHistory
Attempted to undo when no history is available
ValidationError
Validation failed for the provided value
Trait Implementations§
Source§impl Clone for PropertyError
impl Clone for PropertyError
Source§fn clone(&self) -> PropertyError
fn clone(&self) -> PropertyError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more