From 7f61f3cc43314bbe7a97728d77cd5fdc6436a87e Mon Sep 17 00:00:00 2001 From: Stephanie Closson Date: Fri, 10 Apr 2020 11:18:44 -0600 Subject: [PATCH] Fix: 404 is returned as an exception. Catch and if 404, don't worry about it (#23505) --- packages/grafana-toolkit/src/cli/utils/githubRelease.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/grafana-toolkit/src/cli/utils/githubRelease.ts b/packages/grafana-toolkit/src/cli/utils/githubRelease.ts index 9d89a1b751c..e7ddfa83574 100644 --- a/packages/grafana-toolkit/src/cli/utils/githubRelease.ts +++ b/packages/grafana-toolkit/src/cli/utils/githubRelease.ts @@ -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}`,