bito-code-review[bot] commented on PR #44253:
URL: https://github.com/apache/superset/pull/44253#issuecomment-5694828001

   <!-- Bito Reply -->
   The concern regarding `LookupError` is valid in the context of the 
`transaction` decorator's `catches` parameter. By explicitly adding 
`LookupError` to the `catches` tuple in `superset/commands/version_restore.py`, 
the command now correctly intercepts this exception during the `_do_restore()` 
execution, allowing it to be re-raised as the command's `failed_exc` (typically 
resulting in a 422 error) rather than bubbling up as an unhandled exception 
(resulting in a 500 error). The implementation ensures that only 
`SQLAlchemyError` and `LookupError` are caught, preserving the intended 
behavior where other unexpected exceptions propagate through to be handled by 
the endpoint's global error mapping.
   
   **superset/commands/version_restore.py**
   ```
   @transaction(
               on_error=partial(
                   on_error,
                   catches=(SQLAlchemyError, LookupError),
                   reraise=self.failed_exc,
               )
           )
   ```


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