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

   <!-- Bito Reply -->
   The flagged issue is correct. The current implementation of `downloadAsPdf` 
does not handle the rejection of the `domToPdf` promise, meaning failures are 
only logged and the user is not notified via a toast. To resolve this, you 
should wrap the `domToPdf` call in a `try...catch` block and invoke the 
`addWarningToast` callback when an error occurs.
   
   Here is the suggested fix for `superset-frontend/src/utils/downloadAsPdf.ts`:
   
   ```typescript
       try {
         await domToPdf(elementToPrint, options);
       } catch (error) {
         logging.error('PDF capture failed', error);
         addWarningToast?.(t('PDF download failed, please refresh and try 
again.'));
       } finally {
   ```
   
   Would you like me to fetch all other comments on this PR to validate them 
and implement fixes for those as well?
   
   **superset-frontend/src/utils/downloadAsPdf.ts**
   ```
   try {
         await domToPdf(elementToPrint, options);
       } catch (error) {
         logging.error('PDF capture failed', error);
         addWarningToast?.(t('PDF download failed, please refresh and try 
again.'));
       } finally {
   ```


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