File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,19 @@ export const fetchAndCacheGitContributors = async (mdDir: string) => {
53
53
const filepath = join ( "/" , mdDir , "index.md" )
54
54
55
55
// Load cache
56
- const commitHistory = fs . existsSync ( GIT_CONTRIBUTOR_CACHE_JSON )
57
- ? JSON . parse ( fs . readFileSync ( GIT_CONTRIBUTOR_CACHE_JSON , "utf8" ) )
58
- : { }
56
+ let commitHistory = { }
57
+ if ( fs . existsSync ( GIT_CONTRIBUTOR_CACHE_JSON ) ) {
58
+ try {
59
+ commitHistory = JSON . parse (
60
+ fs . readFileSync ( GIT_CONTRIBUTOR_CACHE_JSON , "utf8" )
61
+ )
62
+ } catch ( error ) {
63
+ console . error (
64
+ `Error reading commit history cache for filepath ${ filepath } ` ,
65
+ error
66
+ )
67
+ }
68
+ }
59
69
60
70
// First, check cache for existing commit history for English version (despite locale)
61
71
if ( commitHistory [ filepath ] ) return commitHistory [ filepath ]
You can’t perform that action at this time.
0 commit comments