feat: add more SIP-40 errors to SQL Lab (#15436)

This commit is contained in:
Beto Dealmeida
2021-06-29 18:17:16 -07:00
committed by GitHub
parent 743d9cc928
commit 149c5fd594
6 changed files with 120 additions and 16 deletions

View File

@@ -43,9 +43,11 @@ class SupersetException(Exception):
class SupersetErrorException(SupersetException):
"""Exceptions with a single SupersetErrorType associated with them"""
def __init__(self, error: SupersetError) -> None:
def __init__(self, error: SupersetError, status: Optional[int] = None) -> None:
super().__init__(error.message)
self.error = error
if status is not None:
self.status = status
class SupersetGenericErrorException(SupersetErrorException):
@@ -81,9 +83,13 @@ class SupersetErrorFromParamsException(SupersetErrorException):
class SupersetErrorsException(SupersetException):
"""Exceptions with multiple SupersetErrorType associated with them"""
def __init__(self, errors: List[SupersetError]) -> None:
def __init__(
self, errors: List[SupersetError], status: Optional[int] = None
) -> None:
super().__init__(str(errors))
self.errors = errors
if status is not None:
self.status = status
class SupersetTimeoutException(SupersetErrorFromParamsException):