diff --git a/catalog/ui/src/app/Services/ServicesList.tsx b/catalog/ui/src/app/Services/ServicesList.tsx index 4075dd34c..9b8035480 100644 --- a/catalog/ui/src/app/Services/ServicesList.tsx +++ b/catalog/ui/src/app/Services/ServicesList.tsx @@ -259,7 +259,14 @@ const ServicesList: React.FC<{ resourceClaimName: resourceClaim.metadata.name, }) ); - return await deleteResourceClaim(resourceClaim); + try { + return await deleteResourceClaim(resourceClaim); + } catch (error) { + if (error.status === 404) { + return resourceClaim; + } + throw error; + } } else { const isPartOfWorkshop = isResourceClaimPartOfWorkshop(resourceClaim); if (isPartOfWorkshop) return resourceClaim; // If has a workshopProvision -> Do nothing. @@ -279,7 +286,14 @@ const ServicesList: React.FC<{ const performModalActionForWorkshop = useCallback( async (workshop: WorkshopWithResourceClaims): Promise => { if (modalState.action === 'delete') { - return await deleteWorkshop(workshop); + try { + return await deleteWorkshop(workshop); + } catch (error) { + if (error.status === 404) { + return workshop; + } + throw error; + } } else { if (Array.isArray(workshop.resourceClaims)) { if (modalState.action === 'start') { diff --git a/catalog/ui/src/app/api.ts b/catalog/ui/src/app/api.ts index e44661d1b..6e1f8654e 100644 --- a/catalog/ui/src/app/api.ts +++ b/catalog/ui/src/app/api.ts @@ -1066,14 +1066,14 @@ export async function patchWorkshop({ jsonPatch?: JSONPatch; patch?: Record; }): Promise { - return (await patchK8sObject({ + return await patchK8sObject({ apiVersion: `${BABYLON_DOMAIN}/v1`, jsonPatch: jsonPatch, name: name, namespace: namespace, plural: 'workshops', patch: patch, - })); + }); } export async function patchWorkshopProvision({ @@ -1087,14 +1087,14 @@ export async function patchWorkshopProvision({ jsonPatch?: JSONPatch; patch?: Record; }): Promise { - return (await patchK8sObject({ + return await patchK8sObject({ apiVersion: `${BABYLON_DOMAIN}/v1`, jsonPatch: jsonPatch, name: name, namespace: namespace, plural: 'workshopprovisions', patch: patch, - })); + }); } export async function requestStatusForAllResourcesInResourceClaim(resourceClaim: ResourceClaim) {