handle error in about card when refresh entity fails

Signed-off-by: Brian Fletcher <brian@roadie.io>
This commit is contained in:
Brian Fletcher
2022-11-29 08:29:22 +00:00
parent 89c0b0e6e6
commit 444bba1eff
@@ -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 (