From 7bb9b810ee7dc9292b375cab28d8a559d030f87c Mon Sep 17 00:00:00 2001 From: Daniel Vaz Gaspar Date: Tue, 7 Feb 2023 18:21:32 -0800 Subject: [PATCH] fix: dataset import error message (#23025) --- superset/commands/importers/v1/__init__.py | 3 +++ superset/datasets/commands/exceptions.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/superset/commands/importers/v1/__init__.py b/superset/commands/importers/v1/__init__.py index c620ec9f2a..fc67d1822e 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 96ed7823b0..91af2fdde4 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.")