mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
fix(kubeapi): fix ts api error handling [EE-5558] (#10488)
* fix(kubeapi): fix ts api error handling [EE-5558] * use portainer errors for mapped functions * don't parse long patch responses * allow nested kube error that's thrown to bubble up --------- Co-authored-by: testa113 <testa113>
This commit is contained in:
parent
6c55cac52a
commit
96ead31a8d
17 changed files with 210 additions and 234 deletions
|
@ -10,6 +10,7 @@ import {
|
|||
} from '@/portainer/services/notifications';
|
||||
import { isFulfilled, isRejected } from '@/portainer/helpers/promise-utils';
|
||||
import { pluralize } from '@/portainer/helpers/strings';
|
||||
import PortainerError from '@/portainer/error';
|
||||
|
||||
import { parseKubernetesAxiosError } from '../axiosError';
|
||||
|
||||
|
@ -127,10 +128,7 @@ async function getConfigMapsForCluster(
|
|||
);
|
||||
return configMaps.flat();
|
||||
} catch (e) {
|
||||
throw parseKubernetesAxiosError(
|
||||
e as Error,
|
||||
'Unable to retrieve ConfigMaps for cluster'
|
||||
);
|
||||
throw new PortainerError('Unable to retrieve ConfigMaps', e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,10 +140,7 @@ async function getConfigMaps(environmentId: EnvironmentId, namespace: string) {
|
|||
);
|
||||
return data.items;
|
||||
} catch (e) {
|
||||
throw parseKubernetesAxiosError(
|
||||
e as Error,
|
||||
'Unable to retrieve ConfigMaps'
|
||||
);
|
||||
throw parseKubernetesAxiosError(e, 'Unable to retrieve ConfigMaps');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,7 +152,7 @@ async function deleteConfigMap(
|
|||
try {
|
||||
await axios.delete(buildUrl(environmentId, namespace, name));
|
||||
} catch (e) {
|
||||
throw parseKubernetesAxiosError(e as Error, 'Unable to remove ConfigMap');
|
||||
throw parseKubernetesAxiosError(e, 'Unable to remove ConfigMap');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue