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/10/14 17:05:44 UTC
[superset] branch add-user-error created (now f626856d6c)
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a change to branch add-user-error
in repository https://gitbox.apache.org/repos/asf/superset.git
at f626856d6c add check inside exception
This branch includes the following new commits:
new f626856d6c add check inside exception
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: add check inside exception
Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch add-user-error
in repository https://gitbox.apache.org/repos/asf/superset.git
commit f626856d6c30c24fe28ab5a624d3b6b5894383f2
Author: hughhhh <hu...@gmail.com>
AuthorDate: Fri Oct 14 13:03:47 2022 -0400
add check inside exception
---
superset/sqllab/command.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/superset/sqllab/command.py b/superset/sqllab/command.py
index 613edf8d69..a8ee3c0934 100644
--- a/superset/sqllab/command.py
+++ b/superset/sqllab/command.py
@@ -18,7 +18,7 @@
from __future__ import annotations
import logging
-from typing import Any, Dict, Optional, TYPE_CHECKING
+from typing import Any, Dict, Optional, Set, TYPE_CHECKING
from flask_babel import gettext as __
@@ -53,6 +53,13 @@ logger = logging.getLogger(__name__)
CommandResult = Dict[str, Any]
+# Define set of users client errors these definitions won't
+# be logged as exception vs. warning
+USER_CLIENT_ERRORS: Set[SupersetErrorType] = {
+ SupersetErrorType.SYNTAX_ERROR,
+ SupersetErrorType.COLUMN_DOES_NOT_EXIST_ERROR,
+}
+
class ExecuteSqlCommand(BaseCommand):
_execution_context: SqlJsonExecutionContext
@@ -116,11 +123,11 @@ class ExecuteSqlCommand(BaseCommand):
"payload": self._execution_context_convertor.serialize_payload(),
}
except SupersetErrorsException as ex:
- if all(ex.error_type == SupersetErrorType.SYNTAX_ERROR for ex in ex.errors):
+ if all(ex.error_type in USER_CLIENT_ERRORS for ex in ex.errors):
raise SupersetSyntaxErrorException(ex.errors) from ex
raise ex
except SupersetException as ex:
- if ex.error_type == SupersetErrorType.SYNTAX_ERROR:
+ if ex.error_type in USER_CLIENT_ERRORS:
raise SupersetSyntaxErrorException(
[
SupersetError(