From 04fb46149e73235885dd8f7cb5ce6299ca2f3691 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Tue, 1 Jun 2021 10:39:48 -0700 Subject: [PATCH] Added error handling to wizard --- ui/src/app/metadata/wizard/MetadataProviderWizard.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui/src/app/metadata/wizard/MetadataProviderWizard.js b/ui/src/app/metadata/wizard/MetadataProviderWizard.js index c2d06380d..8d06785a9 100644 --- a/ui/src/app/metadata/wizard/MetadataProviderWizard.js +++ b/ui/src/app/metadata/wizard/MetadataProviderWizard.js @@ -11,6 +11,8 @@ import { useMetadataEntity, useMetadataProviders } from '../hooks/api'; import { useHistory } from 'react-router'; import { removeNull } from '../../core/utility/remove_null'; +import { useNotificationDispatcher, createNotificationAction, NotificationTypes } from '../../notifications/hoc/Notifications'; + export function MetadataProviderWizard({onRestart}) { const { data } = useMetadataProviders({}, []); @@ -31,6 +33,8 @@ export function MetadataProviderWizard({onRestart}) { const wizardDispatch = useWizardDispatcher(); + const notificationDispatch = useNotificationDispatcher(); + const current = useCurrentIndex(); const onChange = (changes) => { @@ -55,7 +59,11 @@ export function MetadataProviderWizard({onRestart}) { if (response.ok) { history.push('/dashboard/metadata/manager/providers'); } else { - console.log(response.body); + const { errorCode, errorMessage, cause } = response.data; + notificationDispatch(createNotificationAction( + `${errorCode}: ${errorMessage} ${cause ? `-${cause}` : ''}`, + NotificationTypes.ERROR + )); } }