display warning for errors calling the github

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2022-04-20 16:49:44 +02:00
parent 8ab2a8226b
commit 6a250106a7
@@ -51,10 +51,22 @@ integrations:
};
async function verifyGithubOrg(org: string): Promise<void> {
const response = await fetch(
`https://api.github.com/orgs/${encodeURIComponent(org)}`,
);
if (!response.ok) {
let response;
try {
response = await fetch(
`https://api.github.com/orgs/${encodeURIComponent(org)}`,
);
} catch (e) {
console.log(
chalk.yellow(
'Warning: Unable to verify existence of GitHub organization. ',
e,
),
);
}
if (response?.status === 404) {
throw new Error(
`GitHub organization '${org}' does not exist. Please verify the name and try again.`,
);