1use std::error::Error;
2use std::fmt;
3use yrs::error::UpdateError;
4
5#[derive(Debug)]
6pub enum StoreError {
7 UpdateError(UpdateError),
8 YrsError(yrs::error::Error),
9 WriteError(String),
10 Error(Box<dyn Error + Send + Sync + 'static>),
11 StorageError(Box<dyn Error + Send + Sync + 'static>),
12}
13
14impl fmt::Display for StoreError {
15 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
16 match self {
17 StoreError::UpdateError(e) => e.fmt(f),
18 StoreError::Error(e) => e.fmt(f),
19 StoreError::StorageError(e) => e.fmt(f),
20 StoreError::YrsError(e) => e.fmt(f),
21 StoreError::WriteError(msg) => write!(f, "Write error: {}", msg),
22 }
23 }
24}
25
26impl Error for StoreError {}