diff --git a/src/service/error.rs b/src/service/error.rs index 74d89521..3323f1f3 100644 --- a/src/service/error.rs +++ b/src/service/error.rs @@ -157,14 +157,14 @@ impl<'a, T> SharedResultExtRef<'a, T> for &'a Result { #[macro_export] macro_rules! api_bail { - ( $fmt:literal $(, $($arg:expr) , *)?) => { - return Err($crate::service::error::ApiError::new(&format!($fmt $(, $($arg) , *)?), axum::http::StatusCode::BAD_REQUEST).into()) + ( $fmt:literal $(, $($arg:tt)*)?) => { + return Err($crate::service::error::ApiError::new(&format!($fmt $(, $($arg)*)?), axum::http::StatusCode::BAD_REQUEST).into()) }; } #[macro_export] macro_rules! api_error { - ( $fmt:literal $(, $($arg:expr) , *)?) => { - $crate::service::error::ApiError::new(&format!($fmt $(, $($arg) , *)?), axum::http::StatusCode::BAD_REQUEST) + ( $fmt:literal $(, $($arg:tt)*)?) => { + $crate::service::error::ApiError::new(&format!($fmt $(, $($arg)*)?), axum::http::StatusCode::BAD_REQUEST) }; } diff --git a/src/setup/auth_registry.rs b/src/setup/auth_registry.rs index fbe3769d..ee382fe7 100644 --- a/src/setup/auth_registry.rs +++ b/src/setup/auth_registry.rs @@ -36,7 +36,13 @@ impl AuthRegistry { let entries = self.entries.read().unwrap(); match entries.get(&entry_ref.key) { Some(value) => Ok(serde_json::from_value(value.clone())?), - None => api_bail!("Auth entry not found: {}", entry_ref.key), + None => api_bail!( + "Auth entry `{key}` not found.\n\ + Hint: If you're not referencing `{key}` in your flow, it will likely be caused by a previously persisted storage target using it. \ + You need to bring back the definition for the auth entry `{key}`, so that CocoIndex will be able to do a cleanup in the next `setup` run. \ + See https://cocoindex.io/docs/core/flow_def#auth-registry for more details.", + key = entry_ref.key + ), } } }