Make Github webhook create error message clearer

This commit is contained in:
Jan Oberhauser 2019-08-08 18:43:35 +02:00
parent f97dbf795a
commit 193dd210ff

View file

@ -352,7 +352,17 @@ export class GithubTrigger implements INodeType {
active: true,
};
const responseData = await githubApiRequest.call(this, 'POST', endpoint, body);
let responseData;
try {
responseData = await githubApiRequest.call(this, 'POST', endpoint, body);
} catch (e) {
if (e.message.includes('[422]:')) {
throw new Error('A webhook with the identical URL exists already. Please delete it manually on Github!');
}
throw e;
}
if (responseData.id === undefined || responseData.active !== true) {
// Required data is missing so was not successful