feat: return security errors in the SIP-40 format (#9796)

This commit is contained in:
Erik Ritter
2020-05-13 17:10:37 -07:00
committed by GitHub
parent cf30e16550
commit d02f2d1fa7
9 changed files with 123 additions and 21 deletions

View File

@@ -14,10 +14,12 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from typing import Optional
from typing import Any, Dict, Optional
from flask_babel import gettext as _
from superset.errors import SupersetError
class SupersetException(Exception):
status = 500
@@ -41,9 +43,12 @@ class SupersetTimeoutException(SupersetException):
class SupersetSecurityException(SupersetException):
status = 401
def __init__(self, msg: str, link: Optional[str] = None) -> None:
super(SupersetSecurityException, self).__init__(msg)
self.link = link
def __init__(
self, error: SupersetError, payload: Optional[Dict[str, Any]] = None
) -> None:
super(SupersetSecurityException, self).__init__(error.message)
self.error = error
self.payload = payload
class NoDataException(SupersetException):