From eb35037bcaae8e7c6eefd645f6aa106cddfe0d5f Mon Sep 17 00:00:00 2001 From: eraden Date: Sun, 30 Jul 2023 22:01:00 +0200 Subject: [PATCH] Display validation errors --- Cargo.toml | 2 +- src/lib.rs | 2 +- src/routes/create_or_edit_post.rs | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 23aa0ab..e01f7e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ name = "actix_admin" path = "src/lib.rs" [features] -default = ["bulma_css"] +default = ["bulma_css", 'enable-tracing'] bulma_css = [] enable-tracing = ['tracing'] diff --git a/src/lib.rs b/src/lib.rs index 46e557b..5010915 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -118,7 +118,7 @@ pub enum ActixAdminError { impl error::ResponseError for ActixAdminError { fn error_response(&self) -> HttpResponse { #[cfg(feature="enable-tracing")] - tracing::debug!("{self}"); + tracing::debug!("{self:#?}"); HttpResponse::build(self.status_code()) .insert_header(ContentType::html()) .body(self.to_string()) diff --git a/src/routes/create_or_edit_post.rs b/src/routes/create_or_edit_post.rs index d8e9f76..fab0e9a 100644 --- a/src/routes/create_or_edit_post.rs +++ b/src/routes/create_or_edit_post.rs @@ -86,6 +86,11 @@ pub async fn create_or_edit_post( if model.has_errors() { errors.push(ActixAdminError::ValidationErrors); + #[cfg(feature="enable-tracing")] + { + tracing::error!("OP errors: {errors:#?}"); + tracing::debug!("Model errors: {:#?}", model.errors); + } render_form::( req, actix_admin,