Display validation errors
This commit is contained in:
parent
0a85d78a9b
commit
eb35037bca
@ -19,7 +19,7 @@ name = "actix_admin"
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["bulma_css"]
|
default = ["bulma_css", 'enable-tracing']
|
||||||
bulma_css = []
|
bulma_css = []
|
||||||
enable-tracing = ['tracing']
|
enable-tracing = ['tracing']
|
||||||
|
|
||||||
|
@ -118,7 +118,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(feature="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())
|
||||||
.body(self.to_string())
|
.body(self.to_string())
|
||||||
|
@ -86,6 +86,11 @@ pub async fn create_or_edit_post<E: ActixAdminViewModelTrait>(
|
|||||||
|
|
||||||
if model.has_errors() {
|
if model.has_errors() {
|
||||||
errors.push(ActixAdminError::ValidationErrors);
|
errors.push(ActixAdminError::ValidationErrors);
|
||||||
|
#[cfg(feature="enable-tracing")]
|
||||||
|
{
|
||||||
|
tracing::error!("OP errors: {errors:#?}");
|
||||||
|
tracing::debug!("Model errors: {:#?}", model.errors);
|
||||||
|
}
|
||||||
render_form::<E>(
|
render_form::<E>(
|
||||||
req,
|
req,
|
||||||
actix_admin,
|
actix_admin,
|
||||||
|
Loading…
Reference in New Issue
Block a user