There was an error while loading. Please reload this page.
1 parent f60dede commit e4d1fd8Copy full SHA for e4d1fd8
pages/contributors/[slug].js
@@ -31,10 +31,16 @@ export async function getServerSideProps({ params }) {
31
let contributorsArray = []
32
contributorFiles.map(filename => {
33
const filePath = path.join(contributorsDirectory, filename)
34
-const fileContents = JSON.parse(fs.readFileSync(filePath, 'utf8'))
35
-contributorsArray.push(fileContents)
+try {
+const fileContents = JSON.parse(fs.readFileSync(filePath, 'utf8'))
36
+contributorsArray.push(fileContents)
37
+}
38
+catch (e) {
39
+console.log('Error reading file -' + filename)
40
41
+
42
})
-
43
44
let obj = contributorsArray.find(o => o["github-username"] === `${params.slug}`);
45
46
return {
0 commit comments