Browse Source

chore: add additional logging during asset upload (#16279)

Michelle Tilley 6 years ago
parent
commit
3db691d693
1 changed files with 8 additions and 4 deletions
  1. 8 4
      script/upload-to-github.js

+ 8 - 4
script/upload-to-github.js

@@ -34,20 +34,24 @@ function uploadToGitHub () {
       console.log(`Error uploading ${fileName} to GitHub, will retry.  Error was:`, err)
       retry++
       github.repos.getRelease(githubOpts).then(release => {
+        console.log('Got list of assets for existing release:')
+        console.log(JSON.stringify(release.data.assets, null, '  '))
         const existingAssets = release.data.assets.filter(asset => asset.name === fileName)
-        console.log('There are', release.data.assets.length, 'existing releases')
-        console.log(JSON.stringify(release.data.assets))
-        console.log(githubOpts)
         if (existingAssets.length > 0) {
           console.log(`${fileName} already exists; will delete before retrying upload.`)
           github.repos.deleteAsset({
             owner: 'electron',
             repo: targetRepo,
             id: existingAssets[0].id
-          }).then(uploadToGitHub).catch(uploadToGitHub)
+          }).catch((deleteErr) => {
+            console.log(`Failed to delete existing asset ${fileName}.  Error was:`, deleteErr)
+          }).then(uploadToGitHub)
         } else {
+          console.log(`Current asset ${fileName} not found in existing assets; retrying upload.`)
           uploadToGitHub()
         }
+      }).catch((getReleaseErr) => {
+        console.log(`Fatal: Unable to get current release assets via getRelease!  Error was:`, getReleaseErr)
       })
     } else {
       console.log(`Error retrying uploading ${fileName} to GitHub:`, err)