Skip to content

Commit

Permalink
deletion exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Jul 25, 2024
1 parent cde7416 commit 7edc6b9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions x-pack/plugins/fleet/server/services/epm/packages/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,19 @@ const deleteSloAssets = async (
namespace: string | undefined,
soClient: SavedObjectsClientContract
) => {
const sloClient = appContextService.getSloStart()?.sloClient;
if (!sloClient) {
return;
}
try {
const sloClient = appContextService.getSloStart()?.sloClient;
if (!sloClient) {
return;
}

const esClient = appContextService.getInternalUserESClient();
const esClient = appContextService.getInternalUserESClient();

for (const { id } of sloAssets) {
await sloClient.deleteSLO({ sloId: id, soClient, esClient, spaceId: namespace ?? 'default' });
for (const { id } of sloAssets) {
await sloClient.deleteSLO({ sloId: id, soClient, esClient, spaceId: namespace ?? 'default' });
}
} catch (err) {
appContextService.getLogger().error(err);
}
};

Expand Down

0 comments on commit 7edc6b9

Please sign in to comment.