Skip to content

Commit

Permalink
Display generic error message if the server hide error detail
Browse files Browse the repository at this point in the history
  • Loading branch information
AxelRieben committed Oct 16, 2024
1 parent 363d8c3 commit e8f1fd3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common/components/ErrorHandler.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { usePrevious } from '../../reactHelper';
import { errorsActions } from '../../store';
import { useTranslation } from './LocalizationProvider';

const ErrorHandler = () => {
const dispatch = useDispatch();
const t = useTranslation();

const error = useSelector((state) => state.errors.errors.find(() => true));
const previousError = usePrevious(error);
Expand All @@ -18,7 +20,7 @@ const ErrorHandler = () => {
severity="error"
variant="filled"
>
{error || previousError}
{error === "HiddenError" ? t("errorTitle") : error ? error : previousError}
</Alert>
</Snackbar>
);
Expand Down

0 comments on commit e8f1fd3

Please sign in to comment.