bito-code-review[bot] commented on code in PR #38254:
URL: https://github.com/apache/superset/pull/38254#discussion_r2854619848
##########
superset/mcp_service/chart/tool/get_chart_preview.py:
##########
@@ -2110,14 +2110,7 @@ async def get_chart_preview(
)
return result
- except (
- CommandException,
- SupersetException,
- ValueError,
- KeyError,
- AttributeError,
- TypeError,
- ) as e:
+ except Exception as e:
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Avoid catching blind Exception type</b></div>
<div id="fix">
Replace the broad `Exception` catch on line 2113 with specific exception
types (e.g., `CommandException`, `SupersetException`, `ValueError`, `KeyError`,
`AttributeError`, `TypeError`) to improve error handling precision and avoid
masking unexpected errors.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
return result
except (
CommandException,
SupersetException,
ValueError,
KeyError,
AttributeError,
TypeError,
) as e:
````
</div>
</details>
</div>
<small><i>Code Review Run #fe6e8e</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
##########
superset/mcp_service/chart/tool/get_chart_data.py:
##########
@@ -691,7 +691,7 @@ async def get_chart_data( # noqa: C901
error_type="DataError",
)
- except (CommandException, SupersetException, ValueError, KeyError) as e:
+ except Exception as e:
await ctx.error(
"Chart data retrieval failed: identifier=%s, error=%s,
error_type=%s"
% (
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Blind exception catch without specific type</b></div>
<div id="fix">
Line 694 catches a blind `Exception` which is too broad. Specify the
exception types that should be caught (e.g., `CommandException`,
`SupersetException`, `ValueError`, `KeyError`) to avoid masking unexpected
errors.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
except (CommandException, SupersetException, ValueError, KeyError,
TypeError) as e:
await ctx.error(
"Chart data retrieval failed: identifier=%s, error=%s,
error_type=%s"
% (
````
</div>
</details>
</div>
<small><i>Code Review Run #fe6e8e</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]