korbit-ai[bot] commented on code in PR #32344:
URL: https://github.com/apache/superset/pull/32344#discussion_r1965560686
##########
superset/jinja_context.py:
##########
@@ -602,7 +601,10 @@ def process_template(self, sql: str, **kwargs: Any) -> str:
kwargs.update(self._context)
context = validate_template_context(self.engine, kwargs)
- return template.render(context)
+ try:
+ return template.render(context)
+ except RecursionError as ex:
+ raise SupersetTemplateException("Cyclic filters detected") from ex
Review Comment:
### Misleading Template Recursion Error Message <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
Generic recursion error message misleads users by suggesting a cyclic filter
issue when it could be any template-related recursion problem.
###### Why this matters
Users will be unable to identify and fix template issues correctly if the
error message suggests cyclic filters when the actual problem might be
different.
###### Suggested change ∙ *Feature Preview*
Make the error message more generic to avoid misleading users:
```python
try:
return template.render(context)
except RecursionError as ex:
raise SupersetTemplateException("Template rendering exceeded maximum
recursion depth") from ex
```
</details>
<sub>
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/0d290a88-24f4-456d-ae0d-0d831a73792a?suggestedFixEnabled=true)
💬 Chat with Korbit by mentioning @korbit-ai.
</sub>
<!--- korbi internal id:9cce6dfc-a6e4-4610-a77d-d94fb7e9c09a -->
--
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]