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/12/05 23:10:30 UTC

[superset] branch datasource-not-found created (now 7ae2484e86)

This is an automated email from the ASF dual-hosted git repository.

hugh pushed a change to branch datasource-not-found
in repository https://gitbox.apache.org/repos/asf/superset.git


      at 7ae2484e86 return 404 instead of 500 for datasource not found

This branch includes the following new commits:

     new 7ae2484e86 return 404 instead of 500 for datasource not found

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[superset] 01/01: return 404 instead of 500 for datasource not found

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch datasource-not-found
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 7ae2484e86e762a02d1358beb6ae34d329574b22
Author: hughhhh <hu...@gmail.com>
AuthorDate: Mon Dec 5 18:09:05 2022 -0500

    return 404 instead of 500 for datasource not found
---
 superset/charts/data/api.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/superset/charts/data/api.py b/superset/charts/data/api.py
index 773229ad5f..b89ef0e956 100644
--- a/superset/charts/data/api.py
+++ b/superset/charts/data/api.py
@@ -41,6 +41,7 @@ from superset.charts.post_processing import apply_post_process
 from superset.charts.schemas import ChartDataQueryContextSchema
 from superset.common.chart_data import ChartDataResultFormat, ChartDataResultType
 from superset.connectors.base.models import BaseDatasource
+from superset.dao.exceptions import DatasourceNotFound
 from superset.exceptions import QueryObjectValidationError
 from superset.extensions import event_logger
 from superset.utils.async_query_manager import AsyncQueryTokenException
@@ -141,6 +142,8 @@ class ChartDataRestApi(ChartRestApi):
             query_context = self._create_query_context_from_form(json_body)
             command = ChartDataCommand(query_context)
             command.validate()
+        except DatasourceNotFound as error:
+            return self.response_404(message=error)
         except QueryObjectValidationError as error:
             return self.response_400(message=error.message)
         except ValidationError as error:
@@ -229,6 +232,8 @@ class ChartDataRestApi(ChartRestApi):
             query_context = self._create_query_context_from_form(json_body)
             command = ChartDataCommand(query_context)
             command.validate()
+        except DatasourceNotFound as error:
+            return self.response_404(message=error)
         except QueryObjectValidationError as error:
             return self.response_400(message=error.message)
         except ValidationError as error: