diegomedina248 commented on a change in pull request #19122:
URL: https://github.com/apache/superset/pull/19122#discussion_r824993436



##########
File path: superset-frontend/src/components/ReportModal/index.tsx
##########
@@ -250,9 +251,16 @@ const ReportModal: FunctionComponent<ReportProps> = ({
         await dispatch(addReport(newReportValues as ReportObject));
         onHide();
       } catch (e) {
-        const parsedError = await getClientErrorObject(e);
-        const errorMessage = parsedError.message;
-        onReducerChange(ActionType.error, errorMessage);
+        const { error } = await getClientErrorObject(e);
+        if (error) {

Review comment:
       It seems the code changed from the time the issue was created.
   The PR that does so is here: https://github.com/apache/superset/pull/17988
   
   Looking at the PR, it seems the idea is to show the message in place, as 
opposed to use the toast.
   Plus, looking at the change here, we're now assuming the error will always 
be a "report already exists" one, which is not correct.
   
   I would suggest trying the following:
   ```js
   const errorMessage = parsedError?.message || parsedError?.error;
   ```
   
   If the error is not there, or if it's empty, we should use a default message 
I believe.
   @rusackas thoughts here? 




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