Exceptions: fix error when transforming django validation errors.

master
Tom Hacohen 4 years ago
parent 43dede57d2
commit 9bf118225d

@ -115,5 +115,5 @@ def transform_validation_error(prefix: str, err: DjangoValidationError):
elif not hasattr(err, "message"): elif not hasattr(err, "message"):
errors = flatten_errors(prefix, err.error_list) errors = flatten_errors(prefix, err.error_list)
else: 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) raise HttpError(code="field_errors", detail="Field validations failed.", errors=errors)

Loading…
Cancel
Save