mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat: generic marshmallow error component (#25303)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user