add more specific error handling for github actions

Previously the errorApi would post a message to the page. However it was
unclear which plugin was causing the error. Instead this renders a panel with
the full error.

Signed-off-by: Brian Fletcher <brian@roadie.io>
This commit is contained in:
Brian Fletcher
2022-10-27 11:18:12 +01:00
parent b725ae2bc7
commit ed438a3ba5
4 changed files with 18 additions and 5 deletions
@@ -29,6 +29,7 @@ import {
useRouteRef,
} from '@backstage/core-plugin-api';
import {
ErrorPanel,
InfoCard,
InfoCardVariants,
Link,
@@ -76,6 +77,11 @@ export const RecentWorkflowRunsCard = (props: {
const githubHost = hostname || 'github.com';
const routeLink = useRouteRef(buildRouteRef);
if (error) {
return <ErrorPanel title={error.message} error={error} />;
}
return (
<InfoCard
title="Recent Workflow Runs"
@@ -87,7 +87,9 @@ export function useWorkflowRuns({
runId: run.id,
});
} catch (e) {
errorApi.post(e);
errorApi.post(
new Error(`Failed to rerun the workflow: ${e.message}`),
);
}
},
source: {