Signed-off-by: Tim Jacomb <timjacomb1@gmail.com>
This commit is contained in:
Tim Jacomb
2022-09-19 08:48:35 +01:00
parent a966ed8385
commit 50577161a4
@@ -27,7 +27,7 @@ import {
} from '@backstage/plugin-permission-common';
import { getBearerTokenFromAuthorizationHeader } from '@backstage/plugin-auth-node';
import { stringifyEntityRef } from '@backstage/catalog-model';
import { stringifyError } from "@backstage/errors";
import { stringifyError } from '@backstage/errors';
/** @public */
export interface RouterOptions {
@@ -92,7 +92,6 @@ export async function createRouter(
backstageToken: token,
});
try {
const projects = await jenkinsApi.getProjects(jenkinsInfo, branches);
@@ -103,9 +102,13 @@ export async function createRouter(
// Promise.any, used in the getProjects call returns an Aggregate error message with a useless error message 'AggregateError: All promises were rejected'
// extract useful information ourselves
if (err.errors) {
throw new Error(`Unable to fetch projects, for ${jenkinsInfo.jobFullName}: ${stringifyError(err.errors)}`)
throw new Error(
`Unable to fetch projects, for ${
jenkinsInfo.jobFullName
}: ${stringifyError(err.errors)}`,
);
}
throw err
throw err;
}
},
);