Skip to content

Commit 2676a24

Browse files
committed
refactor(dashboard): simplify error handling in build-dashboard
1 parent c02a12f commit 2676a24

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

scripts/dashboard/build-dashboard.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,9 @@ async function getDiscussions(
104104
}
105105

106106
return result.search.nodes.concat(await getDiscussions(query, pageSize, result.search.pageInfo.endCursor));
107-
} catch (e) {
108-
logger.error(e);
109-
110-
return Promise.reject(e);
107+
} catch (error) {
108+
logger.error(error);
109+
throw error;
111110
}
112111
}
113112

@@ -138,10 +137,9 @@ async function getDiscussionByID(isPR: boolean, id: string): Promise<PullRequest
138137
});
139138

140139
return result;
141-
} catch (e) {
142-
logger.error(e);
143-
144-
return Promise.reject(e);
140+
} catch (error) {
141+
logger.error(error);
142+
throw error;
145143
}
146144
}
147145

@@ -193,9 +191,9 @@ async function processHotDiscussions(batch: HotDiscussionsIssuesNode[]): Promise
193191
labels: discussion.labels ? discussion.labels.nodes : [],
194192
score: finalInteractionsCount / (monthsSince(discussion.timelineItems.updatedAt) + 2) ** 1.8
195193
};
196-
} catch (e) {
194+
} catch (error) {
197195
logger.error(`there were some issues while parsing this item: ${JSON.stringify(discussion)}`);
198-
throw e;
196+
throw error;
199197
}
200198
})
201199
);
@@ -307,9 +305,9 @@ async function start(writePath: string): Promise<void> {
307305
]);
308306

309307
await writeToFile({ hotDiscussions, goodFirstIssues }, writePath);
310-
} catch (e) {
308+
} catch (error) {
311309
logger.error('There were some issues parsing data from github.');
312-
logger.error(e);
310+
logger.error(error);
313311
}
314312
}
315313

0 commit comments

Comments
 (0)