update webhook response (#2006)

* add hint to 'webhook not registered' error

* Convert hints to constants
This commit is contained in:
MedAliMarz
2021-07-23 20:56:18 +02:00
committed by GitHub
parent 34c1123636
commit 2a99a77b43
3 changed files with 21 additions and 8 deletions

View File

@@ -21,7 +21,7 @@ import {
WorkflowExecuteMode,
} from 'n8n-workflow';
const WEBHOOK_TEST_UNREGISTERED_HINT = `Click the 'Execute workflow' button on the canvas, then try again. (In test mode, the webhook only works for one call after you click this button)`;
export class TestWebhooks {
@@ -72,7 +72,7 @@ export class TestWebhooks {
webhookData = this.activeWebhooks!.get(httpMethod, pathElements.join('/'), webhookId);
if (webhookData === undefined) {
// The requested webhook is not registered
throw new ResponseHelper.ResponseError(`The requested webhook "${httpMethod} ${path}" is not registered.`, 404, 404);
throw new ResponseHelper.ResponseError(`The requested webhook "${httpMethod} ${path}" is not registered.`, 404, 404, WEBHOOK_TEST_UNREGISTERED_HINT);
}
path = webhookData.path;
@@ -90,7 +90,7 @@ export class TestWebhooks {
// TODO: Clean that duplication up one day and improve code generally
if (this.testWebhookData[webhookKey] === undefined) {
// The requested webhook is not registered
throw new ResponseHelper.ResponseError(`The requested webhook "${httpMethod} ${path}" is not registered.`, 404, 404);
throw new ResponseHelper.ResponseError(`The requested webhook "${httpMethod} ${path}" is not registered.`, 404, 404, WEBHOOK_TEST_UNREGISTERED_HINT);
}
const workflow = this.testWebhookData[webhookKey].workflow;
@@ -145,7 +145,7 @@ export class TestWebhooks {
if (webhookMethods === undefined) {
// The requested webhook is not registered
throw new ResponseHelper.ResponseError(`The requested webhook "${path}" is not registered.`, 404, 404);
throw new ResponseHelper.ResponseError(`The requested webhook "${path}" is not registered.`, 404, 404, WEBHOOK_TEST_UNREGISTERED_HINT);
}
return webhookMethods;