Fix: 404 is returned as an exception. Catch and if 404, don't worry about it (#23505)

This commit is contained in:
Stephanie Closson
2020-04-10 11:18:44 -06:00
committed by GitHub
parent 3dde8585ff
commit 7f61f3cc43

View File

@@ -77,7 +77,14 @@ class GitHubRelease {
if (latestRelease.data.tag_name === `v${pluginInfo.version}`) {
await this.git.client.delete(`releases/${latestRelease.data.id}`);
}
} catch (reason) {
if (reason.response.status !== 404) {
// 404 just means no release found. Not an error. Anything else though, re throw the error
throw reason;
}
}
try {
// Now make the release
const newReleaseResponse = await this.git.client.post('releases', {
tag_name: `v${pluginInfo.version}`,