Skip to content

Commit

Permalink
make errors getting issues non-fatal
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mansona committed Apr 15, 2024
1 parent a547462 commit 70cddd2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ export default class Changelog {
await pMap(
commitInfos,
async (commitInfo: CommitInfo) => {
if (commitInfo.issueNumber) {
commitInfo.githubIssue = await this.github.getIssueData(this.config.repo, commitInfo.issueNumber);
try {
if (commitInfo.issueNumber) {
commitInfo.githubIssue = await this.github.getIssueData(this.config.repo, commitInfo.issueNumber);
}
} catch (err: any) {
console.error(`Error getting issue data: ${err.message}`);
}

progressBar.tick();
Expand Down
7 changes: 6 additions & 1 deletion src/github-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ export default class GithubAPI {
if (res.ok) {
return parsedResponse;
}
throw new ConfigurationError(`Fetch error: ${res.statusText}.\n${JSON.stringify(parsedResponse)}`);

if (res.status === 404) {
throw new ConfigurationError(`Not Found [${url}]`);
}

throw new ConfigurationError(`Fetch error [${url}]: ${res.statusText}.\n${JSON.stringify(parsedResponse)}`);
}

private getAuthToken(): string {
Expand Down

0 comments on commit 70cddd2

Please sign in to comment.