Skip to content

Commit

Permalink
fix: Update exception for DatasourceNotFound from `DatasourceDao.get_…
Browse files Browse the repository at this point in the history
…datasource()` (#21217)

* update exception

* add 404
  • Loading branch information
hughhhh committed Aug 26, 2022
1 parent 25cc789 commit 653c9f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions superset/dao/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ class DatasourceTypeNotSupportedError(DAOException):


class DatasourceNotFound(DAOException):
status = 404
message = "Datasource does not exist"
4 changes: 2 additions & 2 deletions superset/explore/commands/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
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
Expand Down Expand Up @@ -114,7 +114,7 @@ def run(self) -> Optional[Dict[str, Any]]:
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]")

Expand Down

0 comments on commit 653c9f0

Please sign in to comment.