codeant-ai-for-open-source[bot] commented on code in PR #43896:
URL: https://github.com/apache/superset/pull/43896#discussion_r4171042661
##########
superset/views/error_handling.py:
##########
@@ -318,7 +318,15 @@ def show_unexpected_exception(ex: Exception) ->
FlaskResponse:
if "text/html" in request.accept_mimetypes and not app.config["DEBUG"]:
path = files("superset") / "static/assets/500.html"
- return send_file(path, max_age=0), 500
+ # Try to serve HTML file; fall back to JSON if not built. This is
the
+ # last-resort handler, so a missing ``500.html`` (a webpack
artifact
+ # absent in API-only/unbuilt deployments) must not raise its own
+ # ``FileNotFoundError`` and collapse the response to a bare 500
with
+ # no SIP-40 body.
+ try:
+ return send_file(path, max_age=0), 500
+ except FileNotFoundError:
+ pass
Review Comment:
**Suggestion:** `send_file` can raise other filesystem errors, such as
`PermissionError` or `NotADirectoryError`, which still escape this last-resort
error handler.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Possible bug`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=e9f9055c8fca4f0eb4867bd3f853c703&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=e9f9055c8fca4f0eb4867bd3f853c703&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/views/error_handling.py
**Line:** 328:329
**Comment:**
*Possible Bug: `send_file` can raise other filesystem errors, such as
`PermissionError` or `NotADirectoryError`, which still escape this last-resort
error handler.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43896&comment_hash=4469e858336ab877d5cf022318c4b36b972649951bce1a118b0e81dc3d69a144&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43896&comment_hash=4469e858336ab877d5cf022318c4b36b972649951bce1a118b0e81dc3d69a144&reaction=dislike'>๐</a>
--
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]