diff --git a/superset/commands/importers/v1/__init__.py b/superset/commands/importers/v1/__init__.py index c620ec9f2..fc67d1822 100644 --- a/superset/commands/importers/v1/__init__.py +++ b/superset/commands/importers/v1/__init__.py @@ -67,6 +67,9 @@ class ImportModelsCommand(BaseCommand): 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 96ed7823b..91af2fdde 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.")