Skip to content

Commit

Permalink
fix(Stats View): 🥅 Error handling in wordCounts
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Aug 13, 2021
1 parent 932b258 commit 6ff5c3e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/Components/TrailGrid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,18 @@
const allCells = [...new Set(sortedTrails.reduce((a, b) => [...a, ...b]))];
const wordCounts: { [cell: string]: number } = {};
allCells.forEach(
(cell) =>
(wordCounts[cell] = app.metadataCache.getFirstLinkpathDest(
allCells.forEach((cell) => {
try {
wordCounts[cell] = app.metadataCache.getFirstLinkpathDest(
cell,
currFile.path
).stat.size)
);
).stat.size;
} catch (error) {
console.log(error);
console.log({ currFile });
wordCounts[cell] = 0
}
});
// const data: {[cell: string]: number} = {}
// allCells.forEach(cell => data[cell] = app.metadataCache.getFileCache(app.metadataCache.getFirstLinkpathDest(cell, currFile.path))?.links.length ?? 0);
Expand Down

0 comments on commit 6ff5c3e

Please sign in to comment.