betodealmeida commented on code in PR #34803:
URL: https://github.com/apache/superset/pull/34803#discussion_r2302264725


##########
superset/datasets/api.py:
##########
@@ -1319,9 +1322,12 @@ def render_item_list(item_list: list[dict[str, Any]]) -> 
list[dict[str, Any]]:
 
             try:
                 data[new_key] = func(data[key])
-            except TemplateSyntaxError as ex:
-                raise SupersetTemplateException(
+            except (TemplateSyntaxError, SupersetSyntaxErrorException) as ex:
+                template_exception = SupersetTemplateException(
                     f"Unable to render expression from dataset {item_type}.",
-                ) from ex
+                )
+
+                template_exception.status = 400

Review Comment:
   I wonder if the status for `SupersetTemplateException` should be changed to 
400, since the template is always provided by the user?



##########
superset/connectors/sqla/models.py:
##########
@@ -686,11 +687,12 @@ def get_sqla_row_level_filters(
             grouped_filters = [or_(*clauses) for clauses in 
filter_groups.values()]
             all_filters.extend(grouped_filters)
             return all_filters
-        except TemplateError as ex:
+        except (TemplateError, SupersetSyntaxErrorException) as ex:
+            msg = ex.message if hasattr(ex, "message") else str(ex)

Review Comment:
   Small nit:
   
   ```suggestion
               msg = getattr(ex, "message", str(ex))
   ```



-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to