fix(bitbucket): log warning when PR creation fails (#5474)

This commit is contained in:
Björn Dahlgren 2020-02-13 11:51:48 +01:00 committed by GitHub
parent 98f1308689
commit 30ee09ca4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -745,22 +745,27 @@ export async function createPr({
reviewers,
};
const prInfo = (
await api.post(`/2.0/repositories/${config.repository}/pullrequests`, {
body,
})
).body;
// TODO: fix types
const pr: Pr = {
number: prInfo.id,
displayNumber: `Pull Request #${prInfo.id}`,
isModified: false,
} as any;
// istanbul ignore if
if (config.prList) {
config.prList.push(pr);
try {
const prInfo = (
await api.post(`/2.0/repositories/${config.repository}/pullrequests`, {
body,
})
).body;
// TODO: fix types
const pr: Pr = {
number: prInfo.id,
displayNumber: `Pull Request #${prInfo.id}`,
isModified: false,
} as any;
// istanbul ignore if
if (config.prList) {
config.prList.push(pr);
}
return pr;
} catch (err) /* istanbul ignore next */ {
logger.warn({ err }, 'Error creating pull request');
throw err;
}
return pr;
}
interface Reviewer {