INFRA-425 | Abhishek | Improve alert messages

This commit is contained in:
Abhishek Katiyar
2020-08-10 16:59:35 +05:30
parent bc58a6af48
commit aba4aac520

View File

@@ -79,6 +79,10 @@ const Form = (props: any) => {
});
};
function getFormattedError(resJson) {
return resJson.message.startsWith("java.lang.RuntimeException:") ? (String(resJson.message)).substr(27) : resJson.message;
}
return (
<div id="mainComponent">
<MenuAppBar
@@ -140,10 +144,7 @@ const Form = (props: any) => {
}
} else {
toast.update(toastId, {
render: formatDisplayData({
error: resJson.error,
message: resJson.message,
}),
render: getFormattedError(resJson),
type: "error",
autoClose: 5000,
});