Fix feature
This commit is contained in:
parent
02a7a36ac7
commit
75b3a112a5
@ -117,7 +117,7 @@ pub enum ActixAdminError {
|
|||||||
|
|
||||||
impl error::ResponseError for ActixAdminError {
|
impl error::ResponseError for ActixAdminError {
|
||||||
fn error_response(&self) -> HttpResponse {
|
fn error_response(&self) -> HttpResponse {
|
||||||
#[cfg(enable-tracing)]
|
#[cfg(feature="enable-tracing")]
|
||||||
tracing::debug!("{self}");
|
tracing::debug!("{self}");
|
||||||
HttpResponse::build(self.status_code())
|
HttpResponse::build(self.status_code())
|
||||||
.insert_header(ContentType::html())
|
.insert_header(ContentType::html())
|
||||||
|
@ -59,7 +59,7 @@ async fn create_or_edit_get<E: ActixAdminViewModelTrait>(session: &Session, req:
|
|||||||
model = res;
|
model = res;
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
#[cfg(enable-tracing)]
|
#[cfg(feature="enable-tracing")]
|
||||||
tracing::error!("{e}");
|
tracing::error!("{e}");
|
||||||
errors.push(e);
|
errors.push(e);
|
||||||
model = ActixAdminModel::create_empty();
|
model = ActixAdminModel::create_empty();
|
||||||
@ -100,7 +100,7 @@ async fn create_or_edit_get<E: ActixAdminViewModelTrait>(session: &Session, req:
|
|||||||
let body = actix_admin.tera
|
let body = actix_admin.tera
|
||||||
.render("create_or_edit.html", &ctx)
|
.render("create_or_edit.html", &ctx)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
#[cfg(enable-tracing)]
|
#[cfg(feature="enable-tracing")]
|
||||||
tracing::error!("{err}");
|
tracing::error!("{err}");
|
||||||
error::ErrorInternalServerError(err)
|
error::ErrorInternalServerError(err)
|
||||||
})?;
|
})?;
|
||||||
|
@ -125,7 +125,7 @@ pub async fn create_or_edit_post<E: ActixAdminViewModelTrait>(
|
|||||||
.finish())
|
.finish())
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
#[cfg(enable-tracing)]
|
#[cfg(feature="enable-tracing")]
|
||||||
tracing::error!("{e}");
|
tracing::error!("{e}");
|
||||||
errors.push(e);
|
errors.push(e);
|
||||||
render_form::<E>(
|
render_form::<E>(
|
||||||
@ -187,7 +187,7 @@ async fn render_form<E: ActixAdminViewModelTrait>(
|
|||||||
let notifications: Vec<ActixAdminNotification> = errors
|
let notifications: Vec<ActixAdminNotification> = errors
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|err| {
|
.map(|err| {
|
||||||
#[cfg(enable-tracing)]
|
#[cfg(feature="enable-tracing")]
|
||||||
tracing::error!("{err}");
|
tracing::error!("{err}");
|
||||||
ActixAdminNotification::from(err)
|
ActixAdminNotification::from(err)
|
||||||
})
|
})
|
||||||
@ -197,7 +197,7 @@ async fn render_form<E: ActixAdminViewModelTrait>(
|
|||||||
let body = actix_admin.tera
|
let body = actix_admin.tera
|
||||||
.render("create_or_edit.html", &ctx)
|
.render("create_or_edit.html", &ctx)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
#[cfg(enable-tracing)]
|
#[cfg(feature="enable-tracing")]
|
||||||
tracing::error!("{err}");
|
tracing::error!("{err}");
|
||||||
error::ErrorInternalServerError(err)
|
error::ErrorInternalServerError(err)
|
||||||
})?;
|
})?;
|
||||||
|
@ -30,7 +30,7 @@ pub async fn index(session: Session, data: web::Data<ActixAdmin>) -> Result<Http
|
|||||||
let body = actix_admin.tera
|
let body = actix_admin.tera
|
||||||
.render("index.html", &ctx)
|
.render("index.html", &ctx)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
#[cfg(enable-tracing)]
|
#[cfg(feature="enable-tracing")]
|
||||||
tracing::error!("{}", e);
|
tracing::error!("{}", e);
|
||||||
error::ErrorInternalServerError("Template error")
|
error::ErrorInternalServerError("Template error")
|
||||||
})?;
|
})?;
|
||||||
@ -41,7 +41,7 @@ pub async fn not_found(data: web::Data<ActixAdmin>) -> Result<HttpResponse, Erro
|
|||||||
let body = data.get_ref().tera
|
let body = data.get_ref().tera
|
||||||
.render("not_found.html", &Context::new())
|
.render("not_found.html", &Context::new())
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
#[cfg(enable-tracing)]
|
#[cfg(feature="enable-tracing")]
|
||||||
tracing::error!("{}", e);
|
tracing::error!("{}", e);
|
||||||
error::ErrorInternalServerError("Template error")
|
error::ErrorInternalServerError("Template error")
|
||||||
})?;
|
})?;
|
||||||
|
Loading…
Reference in New Issue
Block a user