This is an automated email from the ASF dual-hosted git repository.
dpgaspar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 7bb9b810ee fix: dataset import error message (#23025)
7bb9b810ee is described below
commit 7bb9b810ee7dc9292b375cab28d8a559d030f87c
Author: Daniel Vaz Gaspar <[email protected]>
AuthorDate: Tue Feb 7 18:21:32 2023 -0800
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.")