| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,8 +48,19 @@ function updateSponsors() { | |||
| 48 | 48 | logos[id] = 'sponsors/' + file | |
| 49 | 49 | } | |
| 50 | 50 | }) | |
| 51 | - fetch('https://opencollective.com/assemblyscript/members/all.json') | ||
| 52 | - .then(res => res.json()) | ||
| 51 | + fetch('https://opencollective.com/assemblyscript/members/all.json', { | ||
| 52 | + headers: { | ||
| 53 | + accept: 'application/json' | ||
| 54 | + } | ||
| 55 | + }) | ||
| 56 | + .then(async res => { | ||
| 57 | + const text = await res.text() | ||
| 58 | + try { | ||
| 59 | + return JSON.parse(text) | ||
| 60 | + } catch (err) { | ||
| 61 | + throw new Error('Invalid OpenCollective response') | ||
| 62 | + } | ||
| 63 | + }) | ||
| 53 | 64 | .then(json => { | |
| 54 | 65 | const seen = new Map() | |
| 55 | 66 | const sponsors = json | |
@@ -93,8 +104,8 @@ function updateSponsors() { | |||
| 93 | 104 | fs.writeFileSync(__dirname + '/../data/sponsors.json', JSON.stringify(sponsors, null, 2)) | |
| 94 | 105 | }) | |
| 95 | 106 | .catch(err => { | |
| 96 | - console.error(err.stack) | ||
| 97 | - process.exit(1) | ||
| 107 | + console.warn('Failed to update sponsors, keeping cached data') | ||
| 108 | + console.warn(err.message) | ||
| 98 | 109 | }) | |
| 99 | 110 | } | |
| 100 | 111 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments