bito-code-review[bot] commented on code in PR #43771:
URL: https://github.com/apache/superset/pull/43771#discussion_r3923271152


##########
superset/mcp_service/chart/tool/get_chart_data.py:
##########
@@ -419,15 +447,16 @@ async def get_chart_data(  # noqa: C901
                     )
                 try:
                     cached_form_data_dict = utils_json.loads(cached_form_data)
-                except (TypeError, ValueError) as e:
+                except (TypeError, ValueError) as exc:
+                    if type(exc) not in {TypeError, ValueError}:
+                        raise

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Exact-type guard breaks parse fallback</b></div>
   <div id="fix">
   
   `utils_json.loads` delegates to `simplejson.loads`, which raises 
`JSONDecodeError` (a `ValueError` subclass) on invalid JSON. The exact-type 
guard `type(exc) not in {TypeError, ValueError}` re-raises it, so the graceful 
fallback/`ParseError` path never runs. Use `isinstance(exc, (TypeError, 
ValueError))` instead. Same pattern at lines 558-560, 603-605, 686-688.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #bb24a2</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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