rusackas commented on code in PR #44082:
URL: https://github.com/apache/superset/pull/44082#discussion_r4108830167


##########
superset-frontend/src/dashboard/components/menu/DownloadMenuItems/index.tsx:
##########
@@ -348,19 +360,26 @@ export const useDownloadMenuItems = (
         addInfoToast(t('An export for this dashboard is already in 
progress.'));
       }
     } catch (error) {
-      // status comes from the response (Partial<SupersetClientResponse>), 
which
-      // the union type does not expose uniformly; read it via a narrow cast.
-      const { status } = (await getClientErrorObject(error)) as {
+      // The client error union does not expose response fields uniformly.
+      const { status, message } = (await getClientErrorObject(error)) as {
         status?: number;
+        message?: string;
       };
       if (unmountedRef.current) {
         return;
       }
-      if (status === 501) {
-        addDangerToast(t('Excel export is not configured on this server.'));
+      // Show actionable client errors; keep server errors generic.
+      if (message && status && status >= 400 && status < 500) {

Review Comment:
   The pre-existing `ValidationError` path returns `message` as a dict 
(`error.messages`), not a string, and `addDangerToast` renders through 
Interweave which expects a string. Narrow to trigger from the normal UI (it 
only ever sends valid `mode`/`active_data_mask` shapes), but worth guarding.
   
   ```suggestion
         if (typeof message === 'string' && status && status >= 400 && status < 
500) {
   ```



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