diff --git a/superset/commands/importers/v1/__init__.py b/superset/commands/importers/v1/__init__.py index c620ec9f2ac85..fc67d1822e542 100644 --- a/superset/commands/importers/v1/__init__.py +++ b/superset/commands/importers/v1/__init__.py @@ -67,6 +67,9 @@ def run(self) -> None: try: self._import(db.session, self._configs, self.overwrite) db.session.commit() + except CommandException as ex: + db.session.rollback() + raise ex except Exception as ex: db.session.rollback() raise self.import_error() from ex diff --git a/superset/datasets/commands/exceptions.py b/superset/datasets/commands/exceptions.py index 96ed7823b0a04..91af2fdde4e9c 100644 --- a/superset/datasets/commands/exceptions.py +++ b/superset/datasets/commands/exceptions.py @@ -193,5 +193,5 @@ class DatasetDuplicateFailedError(CreateFailedError): message = _("Dataset could not be duplicated.") -class DatasetForbiddenDataURI(ForbiddenError): +class DatasetForbiddenDataURI(ImportFailedError): message = _("Data URI is not allowed.")