Exceptions: fix error when transforming django validation errors.

This commit is contained in:
Tom Hacohen 2021-01-04 10:14:56 +02:00
parent 43dede57d2
commit 9bf118225d

View File

@ -115,5 +115,5 @@ def transform_validation_error(prefix: str, err: DjangoValidationError):
elif not hasattr(err, "message"):
errors = flatten_errors(prefix, err.error_list)
else:
raise HttpError(err.code, err.message)
raise HttpError(err.code or "validation_error", err.message)
raise HttpError(code="field_errors", detail="Field validations failed.", errors=errors)