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>![category Error 
Handling](https://img.shields.io/badge/Error%20Handling-ea580c)</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>
   
   [![Report a problem with this 
comment](https://img.shields.io/badge/Report%20a%20problem%20with%20this%20comment-gray.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmNWVjMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10cmlhbmdsZS1hbGVydCI+PHBhdGggZD0ibTIxLjczIDE4LTgtMTRhMiAyIDAgMCAwLTMuNDggMGwtOCAxNEEyIDIgMCAwIDAgNCAyMWgxNmEyIDIgMCAwIDAgMS43My0zIi8+PHBhdGggZD0iTTEyIDl2NCIvPjxwYXRoIGQ9Ik0xMiAxN2guMDEiLz48L3N2Zz4=)](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]

Reply via email to