Skip to content

Commit

Permalink
Include more details when downloading release fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolftimmermans committed Nov 4, 2019
1 parent f476aa4 commit 70c93d5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion script/ci/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ async function download() {
const [, user, repo] = url.match(/\/([a-z0-9_.-]+)\/([a-z0-9_.-]+)\.git$/i)

const res = await fetch(`https://api.github.com/repos/${user}/${repo}/releases/tags/v${version}`)

if (!res.ok) {
throw new Error(`Github release v${version} not found (${res.status})`)
if (res.status == 404) {
throw new Error(`Github release v${version} not found (${res.status})`)
} else {
const body = await res.text()
throw new Error(`Github release v${version} not accessible (${res.status}): ${body}`)
}
}

const {assets} = await res.json()
Expand Down

0 comments on commit 70c93d5

Please sign in to comment.