Skip to content

Commit 70cddd2

Browse files
committed
make errors getting issues non-fatal
This can happen if someone moves a repo between the previous merge and then a release. The Issue number is the only thing that is used to get issue details but really the full path should be used (if at all possible). This change just prevents this situation from causing an unrecoverable error
1 parent a547462 commit 70cddd2

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/changelog.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,12 @@ export default class Changelog {
169169
await pMap(
170170
commitInfos,
171171
async (commitInfo: CommitInfo) => {
172-
if (commitInfo.issueNumber) {
173-
commitInfo.githubIssue = await this.github.getIssueData(this.config.repo, commitInfo.issueNumber);
172+
try {
173+
if (commitInfo.issueNumber) {
174+
commitInfo.githubIssue = await this.github.getIssueData(this.config.repo, commitInfo.issueNumber);
175+
}
176+
} catch (err: any) {
177+
console.error(`Error getting issue data: ${err.message}`);
174178
}
175179

176180
progressBar.tick();

src/github-api.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ export default class GithubAPI {
6565
if (res.ok) {
6666
return parsedResponse;
6767
}
68-
throw new ConfigurationError(`Fetch error: ${res.statusText}.\n${JSON.stringify(parsedResponse)}`);
68+
69+
if (res.status === 404) {
70+
throw new ConfigurationError(`Not Found [${url}]`);
71+
}
72+
73+
throw new ConfigurationError(`Fetch error [${url}]: ${res.statusText}.\n${JSON.stringify(parsedResponse)}`);
6974
}
7075

7176
private getAuthToken(): string {

0 commit comments

Comments
 (0)