justinpark commented on code in PR #33024:
URL: https://github.com/apache/superset/pull/33024#discussion_r2031907071
##########
superset-frontend/src/SqlLab/actions/sqlLab.js:
##########
@@ -252,28 +252,32 @@ export function querySuccess(query, results) {
return { type: QUERY_SUCCESS, query, results };
}
-export function queryFailed(query, msg, link, errors) {
+export function logFailedQuery(query, errors) {
return function (dispatch) {
const eventData = {
has_err: true,
start_offset: query.startDttm,
ts: new Date().getTime(),
};
- errors?.forEach(({ error_type: errorType, extra }) => {
- const messages = extra?.issue_codes?.map(({ message }) => message) || [
- errorType,
- ];
- messages.forEach(message => {
+ errors?.forEach(({ error_type: errorType, message, extra }) => {
+ const issueCodes = extra?.issue_codes?.map(({ code }) => code) || [-1];
+ issueCodes.forEach(issueCode => {
Review Comment:
The existing messages included in issue_codes are already defined error
messages in the[ issue
code](https://github.com/apache/superset/blob/fd947a097da20ea3163f93ee5262d8313c70a098/superset/errors.py#L105-L109),
whereas the `message` in error block is a error message generated by the
engine.
```
{
"error_type": "GENERIC_DB_ENGINE_ERROR",
"extra": {
"engine_name": "Trino",
"issue_codes": [
{
"code": 1002,
"message": "Issue 1002 - The database returned an unexpected error."
}
]
},
"level": "error",
"message": "trino error: TrinoUserError(type=USER_ERROR,
name=FUNCTION_NOT_FOUND, message=\"line 1:18: Function 'substring1' not
registered\", query_id=xxxx)"
}
```
However, considering the issue of differing formats from the previously
recorded error logs, we maintained the existing logic while adding the error
messages generated by the engine as an additional item.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]