Merge pull request #24 from navi-infra/INFRA-425

INFRA-425 | Abhishek | Improve alert messages
This commit is contained in:
Abhishek Katiyar
2020-08-10 17:02:58 +05:30
committed by GitHub Enterprise

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,
});