use flowy_database::DataBaseError; use std::sync::PoisonError; #[derive(Debug)] pub enum UserError { DBInit(String), DBNotInit, UserNotLogin, DBConnection(String), PoisonError(String), } impl std::convert::From for UserError { fn from(error: DataBaseError) -> Self { UserError::DBInit(format!("{:?}", error)) } } impl std::convert::From> for UserError { fn from(error: PoisonError) -> Self { UserError::PoisonError(format!("{:?}", error)) } } impl std::convert::From for UserError { fn from(e: flowy_sqlite::Error) -> Self { UserError::DBConnection(format!("{:?}", e)) } }