You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2022/08/26 22:11:59 UTC
[superset] branch master updated: fix: Update exception for DatasourceNotFound from `DatasourceDao.get_datasource()` (#21217)
This is an automated email from the ASF dual-hosted git repository.
hugh 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 653c9f0e7f fix: Update exception for DatasourceNotFound from `DatasourceDao.get_datasource()` (#21217)
653c9f0e7f is described below
commit 653c9f0e7fd319bf0a10f75839fa8f89d4fea66f
Author: Hugh A. Miles II <hu...@gmail.com>
AuthorDate: Fri Aug 26 15:11:47 2022 -0700
fix: Update exception for DatasourceNotFound from `DatasourceDao.get_datasource()` (#21217)
* update exception
* add 404
---
superset/dao/exceptions.py | 1 +
superset/explore/commands/get.py | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/superset/dao/exceptions.py b/superset/dao/exceptions.py
index 93cb25d3fc..a11db63a4c 100644
--- a/superset/dao/exceptions.py
+++ b/superset/dao/exceptions.py
@@ -65,4 +65,5 @@ class DatasourceTypeNotSupportedError(DAOException):
class DatasourceNotFound(DAOException):
+ status = 404
message = "Datasource does not exist"
diff --git a/superset/explore/commands/get.py b/superset/explore/commands/get.py
index 1b9ec433da..3a656ea2b9 100644
--- a/superset/explore/commands/get.py
+++ b/superset/explore/commands/get.py
@@ -27,7 +27,7 @@ from superset import db, security_manager
from superset.commands.base import BaseCommand
from superset.connectors.base.models import BaseDatasource
from superset.connectors.sqla.models import SqlaTable
-from superset.datasets.commands.exceptions import DatasetNotFoundError
+from superset.dao.exceptions import DatasourceNotFound
from superset.datasource.dao import DatasourceDAO
from superset.exceptions import SupersetException
from superset.explore.commands.parameters import CommandParameters
@@ -114,7 +114,7 @@ class GetExploreCommand(BaseCommand, ABC):
dataset = DatasourceDAO.get_datasource(
db.session, cast(str, self._dataset_type), self._dataset_id
)
- except DatasetNotFoundError:
+ except DatasourceNotFound:
pass
dataset_name = dataset.name if dataset else _("[Missing Dataset]")