Skip to content

Commit

Permalink
gen-changelog: Fix error handling and improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Dec 29, 2019
1 parent 8ddef33 commit 8ea11f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions resources/gen-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,17 @@ function genChangeLog(tag, date, allPRs) {
.filter(label => label.startsWith('PR: '));

if (labels.length === 0) {
throw new Error(`PR #${pr.number} missing label`);
throw new Error(`PR is missing label. See ${pr.url}`);
}
if (labels.length > 1) {
throw new Error(
`PR #${pr.number} has conflicting labels: ` + labels.join('\n'),
`PR has conflicting labels: ${labels.join('\n')}\nSee ${pr.url}`,
);
}

const label = labels[0];
if (!labelsConfig[label]) {
throw new Error('Unknown label: ' + label + pr.number);
throw new Error(`Unknown label: ${label}. See ${pr.url}`);
}
byLabel[label] = byLabel[label] || [];
byLabel[label].push(pr);
Expand Down Expand Up @@ -185,7 +185,7 @@ function graphqlRequestImpl(query, variables, cb) {
});
});

req.on('error', error => cb(error));
req.on('error', error => resultCB(error));
req.write(JSON.stringify({ query, variables }));
req.end();
}
Expand Down

0 comments on commit 8ea11f6

Please sign in to comment.