From 693add6bd3647af4e8f28e3bee59bbbf9f591c0e Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Fri, 25 Sep 2020 23:03:29 -0700 Subject: [PATCH 1/3] fix: surface connection error messages on the client --- .../src/views/CRUD/data/database/DatabaseModal.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx index 0b2074f157eaf..8b49492fc657f 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx @@ -21,6 +21,7 @@ import { styled, t, SupersetClient } from '@superset-ui/core'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; import { useSingleViewResource } from 'src/views/CRUD/hooks'; import withToasts from 'src/messageToasts/enhancers/withToasts'; +import getClientErrorObject from 'src/utils/getClientErrorObject'; import Icon from 'src/components/Icon'; import Modal from 'src/common/components/Modal'; import Tabs from 'src/common/components/Tabs'; @@ -163,11 +164,11 @@ const DatabaseModal: FunctionComponent = ({ .then(() => { addSuccessToast(t('Connection looks good!')); }) - .catch(() => { - addDangerToast( - t('ERROR: Connection failed, please check your connection settings'), - ); - }); + .catch(response => + getClientErrorObject(response).then((error) => { + addDangerToast(t('ERROR: Connection failed. ') + error?.message || '', + }), + ); }; // Functions From e4b20bc83bbb733e3335ec194ff34ce99e43becb Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Fri, 25 Sep 2020 23:14:30 -0700 Subject: [PATCH 2/3] typo --- .../src/views/CRUD/data/database/DatabaseModal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx index 8b49492fc657f..a6a466f8e465e 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx @@ -166,7 +166,7 @@ const DatabaseModal: FunctionComponent = ({ }) .catch(response => getClientErrorObject(response).then((error) => { - addDangerToast(t('ERROR: Connection failed. ') + error?.message || '', + addDangerToast(t('ERROR: Connection failed. ') + error?.message || ''); }), ); }; @@ -552,7 +552,7 @@ const DatabaseModal: FunctionComponent = ({ checked={db ? !!db.impersonate_user : false} onChange={onInputChange} /> -
{t('Impersonate Logged In User (Presto & Hive')}
+
{t('Impersonate Logged In User (Presto & Hive)')}
Date: Sat, 26 Sep 2020 08:00:20 -0700 Subject: [PATCH 3/3] lint --- .../src/views/CRUD/data/database/DatabaseModal.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx index a6a466f8e465e..f0e2c6cdfa22c 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx @@ -165,8 +165,10 @@ const DatabaseModal: FunctionComponent = ({ addSuccessToast(t('Connection looks good!')); }) .catch(response => - getClientErrorObject(response).then((error) => { - addDangerToast(t('ERROR: Connection failed. ') + error?.message || ''); + getClientErrorObject(response).then(error => { + addDangerToast( + t('ERROR: Connection failed. ') + error?.message || '', + ); }), ); };