feat: generic marshmallow error component (#25303)

This commit is contained in:
Beto Dealmeida
2023-10-03 11:35:28 -07:00
committed by GitHub
parent dbe0838f8f
commit 3e63c82ecc
13 changed files with 376 additions and 35 deletions

View File

@@ -278,3 +278,20 @@ class QueryNotFoundException(SupersetException):
class ColumnNotFoundException(SupersetException):
status = 404
class SupersetMarshmallowValidationError(SupersetErrorException):
"""
Exception to be raised for Marshmallow validation errors.
"""
status = 422
def __init__(self, exc: ValidationError, payload: dict[str, Any]):
error = SupersetError(
message=_("The schema of the submitted payload is invalid."),
error_type=SupersetErrorType.MARSHMALLOW_ERROR,
level=ErrorLevel.ERROR,
extra={"messages": exc.messages, "payload": payload},
)
super().__init__(error)