From da466306e195ea072ddc93f5a601de4db48449d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Wo=C5=BAniak?= Date: Fri, 28 Jul 2023 22:05:25 +0200 Subject: [PATCH] Update create_or_edit_post.rs --- src/routes/create_or_edit_post.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/routes/create_or_edit_post.rs b/src/routes/create_or_edit_post.rs index 4c54d9f..4eb1265 100644 --- a/src/routes/create_or_edit_post.rs +++ b/src/routes/create_or_edit_post.rs @@ -125,6 +125,8 @@ pub async fn create_or_edit_post( .finish()) } Err(e) => { + #[cfg(enable_tracing)] + tracing::error!("{e}"); errors.push(e); render_form::( req, @@ -184,13 +186,21 @@ async fn render_form( let notifications: Vec = errors .into_iter() - .map(|err| ActixAdminNotification::from(err)) + .map(|err| { + #[cfg(enable_tracing)] + tracing::error!("{e}"); + ActixAdminNotification::from(err) + }) .collect(); ctx.insert("notifications", ¬ifications); let body = actix_admin.tera .render("create_or_edit.html", &ctx) - .map_err(|err| error::ErrorInternalServerError(err))?; + .map_err(|err| { + #[cfg(enable_tracing)] + tracing::error!("{e}"); + error::ErrorInternalServerError(err) + })?; Ok(HttpResponse::Ok().content_type("text/html").body(body)) }