bito-code-review[bot] commented on code in PR #38827:
URL: https://github.com/apache/superset/pull/38827#discussion_r2981403350
##########
superset/mcp_service/dashboard/tool/generate_dashboard.py:
##########
@@ -355,8 +384,8 @@ def generate_dashboard(
dashboard=dashboard_info, dashboard_url=dashboard_url, error=None
)
- except Exception as e:
- logger.error("Error creating dashboard: %s", e)
+ except (SQLAlchemyError, ValueError, AttributeError) as e:
+ logger.error("Error creating dashboard: %s", e, exc_info=True)
return GenerateDashboardResponse(
dashboard=None,
dashboard_url=None,
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Narrow exception handling risks uncaught errors</b></div>
<div id="fix">
The exception handling was narrowed to (SQLAlchemyError, ValueError,
AttributeError), but serialization functions can raise ValidationError or other
exceptions, causing unhandled errors to propagate instead of returning an error
response. This changes the tool's behavior unexpectedly.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```
- except (SQLAlchemyError, ValueError, AttributeError) as e:
- logger.error("Error creating dashboard: %s", e, exc_info=True)
- return GenerateDashboardResponse(
- dashboard=None,
- dashboard_url=None,
- error=f"Failed to create dashboard: {str(e)}",
- )
+ except Exception as e:
+ logger.error("Error creating dashboard: %s", e)
+ return GenerateDashboardResponse(
- dashboard=None,
- dashboard_url=None,
- error=f"Failed to create dashboard: {str(e)}",
- )
```
</div>
</details>
</div>
<small><i>Code Review Run #461bd1</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]