From 444bba1eff2a5eb0abfc7bde4aa7b6fe7d9cacc9 Mon Sep 17 00:00:00 2001 From: Brian Fletcher Date: Tue, 29 Nov 2022 08:29:22 +0000 Subject: [PATCH] handle error in about card when refresh entity fails Signed-off-by: Brian Fletcher --- .../catalog/src/components/AboutCard/AboutCard.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/catalog/src/components/AboutCard/AboutCard.tsx b/plugins/catalog/src/components/AboutCard/AboutCard.tsx index b7ccd49b31..7c0c8e69f7 100644 --- a/plugins/catalog/src/components/AboutCard/AboutCard.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutCard.tsx @@ -139,8 +139,15 @@ export function AboutCard(props: AboutCardProps) { const allowRefresh = entityLocation?.startsWith('url:') || entityLocation?.startsWith('file:'); const refreshEntity = useCallback(async () => { - await catalogApi.refreshEntity(stringifyEntityRef(entity)); - alertApi.post({ message: 'Refresh scheduled', severity: 'info' }); + try { + await catalogApi.refreshEntity(stringifyEntityRef(entity)); + alertApi.post({ message: 'Refresh scheduled', severity: 'info' }); + } catch (e) { + alertApi.post({ + message: `Failed to schedule refresh: ${e.message}`, + severity: 'error', + }); + } }, [catalogApi, alertApi, entity]); return (