From 193dd210ff9eed5c82184524e5eb6d91432a8995 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Thu, 8 Aug 2019 18:43:35 +0200 Subject: [PATCH] :zap: Make Github webhook create error message clearer --- .../nodes-base/nodes/Github/GithubTrigger.node.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/Github/GithubTrigger.node.ts b/packages/nodes-base/nodes/Github/GithubTrigger.node.ts index 09da267953..2dc53ee6c6 100644 --- a/packages/nodes-base/nodes/Github/GithubTrigger.node.ts +++ b/packages/nodes-base/nodes/Github/GithubTrigger.node.ts @@ -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