bito-code-review[bot] commented on PR #43479:
URL: https://github.com/apache/superset/pull/43479#issuecomment-5399510218
<!-- Bito Reply -->
The flagged issue is correct. In `superset/daos/base.py`, the
`OperationalError` is caught and re-raised, but if the surrounding API layer
catches it as a generic `SQLAlchemyError` (or `DatabaseError`), it may be
mapped to a 422 Unprocessable Entity instead of a 5xx Server Error. To resolve
this, you should ensure that `OperationalError` is explicitly handled by the
API exception handler to return a 500 status code, or wrap it in a custom
exception that the API layer maps to 500.
Since I do not have access to the API exception handler code in this diff, I
recommend checking where `DAOFindFailedError` or other DAO exceptions are
caught in your API controllers and adding an explicit handler for
`OperationalError` there.
**superset/daos/base.py**
```
except OperationalError:
# A transient connection-level failure (e.g. the server dropping
the
# connection mid-query) surfaces as OperationalError. Let it
propagate
# as a 5xx instead of masking it as a 400 "record doesn't exist".
raise
```
--
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]