Skip to content
Snippets Groups Projects
Commit 2c03cb57 authored by Max Frederiksen's avatar Max Frederiksen Committed by Max Frederiksen
Browse files

use getErrorMessage in DeployIOC and UndeployIOC

parent a73b842f
No related branches found
No related tags found
3 merge requests!542Prepare 4.1.0,!540Sync,!533CE-3015: Implement correct error handling for operation errors
...@@ -3,6 +3,7 @@ import { Navigate } from "react-router-dom"; ...@@ -3,6 +3,7 @@ import { Navigate } from "react-router-dom";
import { IOCDeployDialog } from "../IOCDeployDialog"; import { IOCDeployDialog } from "../IOCDeployDialog";
import { apiContext } from "../../../api/DeployApi"; import { apiContext } from "../../../api/DeployApi";
import { useAPIMethod } from "@ess-ics/ce-ui-common"; import { useAPIMethod } from "@ess-ics/ce-ui-common";
import { getErrorMessage } from "../../common/Helper";
// Process component // Process component
export function DeployIOC({ export function DeployIOC({
...@@ -29,11 +30,7 @@ export function DeployIOC({ ...@@ -29,11 +30,7 @@ export function DeployIOC({
useEffect(() => { useEffect(() => {
if (deployError) { if (deployError) {
setButtonDisabled(false); setButtonDisabled(false);
setError( setError(getErrorMessage(deployError));
deployError?.response?.body?.description ??
deployError?.message ??
"An unknown error occurred"
);
} }
}, [deployError, setButtonDisabled]); }, [deployError, setButtonDisabled]);
......
...@@ -3,6 +3,7 @@ import { Navigate } from "react-router-dom"; ...@@ -3,6 +3,7 @@ import { Navigate } from "react-router-dom";
import { IOCUndeployDialog } from "../IOCUndeployDialog"; import { IOCUndeployDialog } from "../IOCUndeployDialog";
import { apiContext } from "../../../api/DeployApi"; import { apiContext } from "../../../api/DeployApi";
import { useAPIMethod } from "@ess-ics/ce-ui-common"; import { useAPIMethod } from "@ess-ics/ce-ui-common";
import { getErrorMessage } from "../../common/Helper";
// Process component // Process component
export function UndeployIOC({ export function UndeployIOC({
...@@ -27,7 +28,7 @@ export function UndeployIOC({ ...@@ -27,7 +28,7 @@ export function UndeployIOC({
useEffect(() => { useEffect(() => {
if (deploymentError) { if (deploymentError) {
setButtonDisabled(false); setButtonDisabled(false);
setError(deploymentError?.message); setError(getErrorMessage(deploymentError));
} }
}, [deploymentError, setButtonDisabled]); }, [deploymentError, setButtonDisabled]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment