From 4ecbf6da15c144e1973ed3b1bca4455c23ba69f3 Mon Sep 17 00:00:00 2001 From: Ethan Girouard Date: Sat, 27 Jun 2026 15:17:22 -0400 Subject: [PATCH] Add error type for key-value store --- src/util/error.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/util/error.rs b/src/util/error.rs index 95f8f4b..504c7d6 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -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 for Error { @@ -308,3 +313,11 @@ impl From for Error { Error::new_here(ErrorType::Database(format!("{err}"))) } } + +#[cfg(feature = "server")] +impl From for Error { + #[track_caller] + fn from(err: fred::error::Error) -> Self { + Error::new_here(ErrorType::KeyValStore(format!("{err}"))) + } +}