Skip to content

Commit

Permalink
Added error handling to wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Jun 1, 2021
1 parent 098d1f0 commit 04fb461
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ui/src/app/metadata/wizard/MetadataProviderWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({}, []);
Expand All @@ -31,6 +33,8 @@ export function MetadataProviderWizard({onRestart}) {

const wizardDispatch = useWizardDispatcher();

const notificationDispatch = useNotificationDispatcher();

const current = useCurrentIndex();

const onChange = (changes) => {
Expand All @@ -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
));
}
}

Expand Down

0 comments on commit 04fb461

Please sign in to comment.