sadpandajoe commented on code in PR #35800:
URL: https://github.com/apache/superset/pull/35800#discussion_r2475475819


##########
superset/commands/report/execute.py:
##########
@@ -757,9 +772,20 @@ def next(self) -> None:
             if isinstance(first_ex, SupersetErrorsException):
                 error_message = ";".join([error.message for error in 
first_ex.errors])
 
-            self.update_report_schedule_and_log(
-                ReportState.ERROR, error_message=error_message
-            )
+            try:
+                self.update_report_schedule_and_log(
+                    ReportState.ERROR, error_message=error_message
+                )
+            except ReportScheduleUnexpectedError:
+                # Logging failed (likely StaleDataError), but we still want to
+                # raise the original error so the root cause remains visible
+                logger.warning(
+                    "Failed to log error for report schedule %s due to 
database issue",
+                    self._report_schedule.id,
+                    exc_info=True,
+                )
+                # Re-raise the original exception, not the logging failure
+                raise first_ex from None

Review Comment:
   re-raising first_ex with from None clears its __cause__, so when the 
original failure is a eportScheduleUnexpectedError (wrapping a StaleDataError) 
we lose the underlying concurrency stack trace; please re-raise without from 
None (or otherwise preserve the cause) so operators can still see the 
stale-write details.



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