Adds ErrorBoundary around stories

This commit is contained in:
Josh Perez 2022-07-28 20:10:07 -04:00 committed by GitHub
parent 37f9346f57
commit d7ec2e9d82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 85 additions and 3 deletions

View file

@ -20,6 +20,21 @@ export const ToastManager = ({
i18n,
toastType,
}: PropsType): JSX.Element | null => {
if (toastType === ToastType.Error) {
return (
<Toast
autoDismissDisabled
onClose={hideToast}
toastAction={{
label: i18n('Toast--error--action'),
onClick: () => window.showDebugLog(),
}}
>
{i18n('Toast--error')}
</Toast>
);
}
if (toastType === ToastType.MessageBodyTooLong) {
return <ToastMessageBodyTooLong i18n={i18n} onClose={hideToast} />;
}