lyndsiWilliams commented on a change in pull request #17988: URL: https://github.com/apache/superset/pull/17988#discussion_r781638769
########## File path: superset-frontend/src/components/ReportModal/index.tsx ########## @@ -235,15 +244,19 @@ const ReportModal: FunctionComponent<ReportProps> = ({ await dispatch( editReport(currentReport?.id, newReportValues as ReportObject), ); + onHide(); } else { - await dispatch(addReport(newReportValues as ReportObject)); + try { + await dispatch(addReport(newReportValues as ReportObject)); + onHide(); + } catch (e) { + const parsedError = await getClientErrorObject(e); + const errorMessage = parsedError.message; + onReducerChange(ActionType.error, errorMessage); + } } - if (onReportAdd) { - onReportAdd(); - } - - onClose(); + if (onReportAdd) onReportAdd(); Review comment: Oh okay awesome, I'll keep an eye out for that behavior in the future just in case! Thank you! 😁 ########## File path: superset-frontend/src/reports/actions/reports.js ########## @@ -105,22 +104,10 @@ export const addReport = report => dispatch => SupersetClient.post({ endpoint: `/api/v1/report/`, jsonPayload: report, - }) - .then(({ json }) => { - dispatch({ type: ADD_REPORT, json }); - dispatch(addSuccessToast(t('The report has been created'))); - }) - .catch(async e => { - const parsedError = await getClientErrorObject(e); - const errorMessage = parsedError.message; - const errorArr = Object.keys(errorMessage); - const error = errorMessage[errorArr[0]]; - dispatch( - addDangerToast( - t('An error occurred while editing this report: %s', error), - ), - ); - }); + }).then(({ json }) => { + dispatch({ type: ADD_REPORT, json }); + dispatch(addSuccessToast(t('The report has been created'))); + }); Review comment: No problem! 😁 -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org