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
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-github-actions': patch
---
Add error panel when the plugin fails.
@@ -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: {
+4 -4
View File
@@ -3314,7 +3314,7 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/catalog-model@npm:^1.1.1, @backstage/catalog-model@npm:^1.1.2":
"@backstage/catalog-model@npm:^1.1.2":
version: 1.1.2
resolution: "@backstage/catalog-model@npm:1.1.2"
dependencies:
@@ -3599,7 +3599,7 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/core-components@npm:^0.11.1, @backstage/core-components@npm:^0.11.2":
"@backstage/core-components@npm:^0.11.2":
version: 0.11.2
resolution: "@backstage/core-components@npm:0.11.2"
dependencies:
@@ -3722,7 +3722,7 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/core-plugin-api@npm:^1.0.6, @backstage/core-plugin-api@npm:^1.0.7":
"@backstage/core-plugin-api@npm:^1.0.7":
version: 1.0.7
resolution: "@backstage/core-plugin-api@npm:1.0.7"
dependencies:
@@ -5066,7 +5066,7 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/plugin-catalog-react@npm:^1.1.4, @backstage/plugin-catalog-react@npm:^1.2.0":
"@backstage/plugin-catalog-react@npm:^1.2.0":
version: 1.2.0
resolution: "@backstage/plugin-catalog-react@npm:1.2.0"
dependencies: