Add error type for key-value store

This commit is contained in:
2026-06-27 15:17:22 -04:00
parent 674b58e290
commit 4ecbf6da15

View File

@@ -292,6 +292,11 @@ pub enum ErrorType {
#[error("Server function error: {0}")]
ServerFnError(ServerFnError),
// Using string to represent Fred errors, because Fred's Error type is not `Serialize`,
// and Fred is only available on the server
#[error("Key-value store error: {0}")]
KeyValStore(String),
}
impl From<ErrorType> for Error {
@@ -308,3 +313,11 @@ impl From<diesel::result::Error> for Error {
Error::new_here(ErrorType::Database(format!("{err}")))
}
}
#[cfg(feature = "server")]
impl From<fred::error::Error> for Error {
#[track_caller]
fn from(err: fred::error::Error) -> Self {
Error::new_here(ErrorType::KeyValStore(format!("{err}")))
}
}