Skip to content

Commit 502a6c4

Browse files
authored
Fixed snackMessage to display if error returned creating policy (#2726)
1 parent ceafdb9 commit 502a6c4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

portal-ui/src/screens/Console/Policies/AddPolicyScreen.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import InputBoxWrapper from "../Common/FormComponents/InputBoxWrapper/InputBoxWr
2323
import AddPolicyHelpBox from "./AddPolicyHelpBox";
2424
import CodeMirrorWrapper from "../Common/FormComponents/CodeMirrorWrapper/CodeMirrorWrapper";
2525
import { IAM_PAGES } from "../../../common/SecureComponent/permissions";
26-
import { ErrorResponseHandler } from "../../../common/types";
2726
import FormLayout from "../Common/FormLayout";
2827
import { setErrorSnackMessage } from "../../../systemSlice";
2928
import { useNavigate } from "react-router-dom";
@@ -56,9 +55,17 @@ const AddPolicyScreen = () => {
5655
setAddLoading(false);
5756
navigate(`${IAM_PAGES.POLICIES}`);
5857
})
59-
.catch((err: ErrorResponseHandler) => {
58+
.catch((err: HttpResponse<Policy, Error>) => {
6059
setAddLoading(false);
61-
dispatch(setErrorSnackMessage(err));
60+
dispatch(
61+
setErrorSnackMessage({
62+
errorMessage: "There was an error creating a Policy ",
63+
detailedError:
64+
"There was an error creating a Policy: " +
65+
(err.error.detailedMessage || "") +
66+
". Please check Policy syntax.",
67+
})
68+
);
6269
});
6370
};
6471

0 commit comments

Comments
 (0)