From 910791b00b4e3564764dc7b2859e3533b9349b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CA=88=E1=B5=83=E1=B5=A2?= Date: Mon, 26 Oct 2020 13:33:19 -0700 Subject: [PATCH] fix: better error message for chart properties modal (#11381) --- .../src/explore/components/PropertiesModal.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/explore/components/PropertiesModal.tsx b/superset-frontend/src/explore/components/PropertiesModal.tsx index 12e006dce..eccc6bab7 100644 --- a/superset-frontend/src/explore/components/PropertiesModal.tsx +++ b/superset-frontend/src/explore/components/PropertiesModal.tsx @@ -63,13 +63,17 @@ function PropertiesModal({ slice, onHide, onSave }: InternalProps) { ); const [owners, setOwners] = useState | null>(null); - function showError({ error, statusText }: any) { + function showError({ error, statusText, message }: any) { + let errorText = error || statusText || t('An error has occurred'); + if (message === 'Forbidden') { + errorText = t('You do not have permission to edit this chart'); + } errorDialog.current.show({ title: 'Error', bsSize: 'medium', bsStyle: 'danger', actions: [Dialog.DefaultAction('Ok', () => {}, 'btn-danger')], - body: error || statusText || t('An error has occurred'), + body: errorText, }); }