mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): Improve webhook error messages
This commit is contained in:
@@ -165,7 +165,7 @@ export async function executeWebhook(
|
||||
workflowStartNode.typeVersion,
|
||||
);
|
||||
if (nodeType === undefined) {
|
||||
const errorMessage = `The type of the webhook node "${workflowStartNode.name}" is not known.`;
|
||||
const errorMessage = `The type of the webhook node "${workflowStartNode.name}" is not known`;
|
||||
responseCallback(new Error(errorMessage), {});
|
||||
throw new ResponseHelper.ResponseError(errorMessage, 500, 500);
|
||||
}
|
||||
@@ -222,7 +222,7 @@ export async function executeWebhook(
|
||||
// If the mode is not known we error. Is probably best like that instead of using
|
||||
// the default that people know as early as possible (probably already testing phase)
|
||||
// that something does not resolve properly.
|
||||
const errorMessage = `The response mode ${responseMode} is not valid!`;
|
||||
const errorMessage = `The response mode '${responseMode}' is not valid!`;
|
||||
responseCallback(new Error(errorMessage), {});
|
||||
throw new ResponseHelper.ResponseError(errorMessage, 500, 500);
|
||||
}
|
||||
@@ -329,7 +329,7 @@ export async function executeWebhook(
|
||||
if (!didSendResponse) {
|
||||
responseCallback(null, {
|
||||
data: {
|
||||
message: 'Webhook call got received.',
|
||||
message: 'Webhook call received',
|
||||
},
|
||||
responseCode,
|
||||
});
|
||||
@@ -357,7 +357,7 @@ export async function executeWebhook(
|
||||
} else {
|
||||
responseCallback(null, {
|
||||
data: {
|
||||
message: 'Workflow got started.',
|
||||
message: 'Workflow was started',
|
||||
},
|
||||
responseCode,
|
||||
});
|
||||
@@ -471,7 +471,7 @@ export async function executeWebhook(
|
||||
if (!didSendResponse) {
|
||||
responseCallback(null, {
|
||||
data: {
|
||||
message: 'Workflow did execute sucessfully but no data got returned.',
|
||||
message: 'Workflow executed sucessfully but no data was returned',
|
||||
},
|
||||
responseCode,
|
||||
});
|
||||
@@ -485,7 +485,7 @@ export async function executeWebhook(
|
||||
if (!didSendResponse) {
|
||||
responseCallback(null, {
|
||||
data: {
|
||||
message: 'Workflow did error.',
|
||||
message: 'Error in workflow',
|
||||
},
|
||||
responseCode: 500,
|
||||
});
|
||||
@@ -499,7 +499,7 @@ export async function executeWebhook(
|
||||
// Return an error if no Webhook-Response node did send any data
|
||||
responseCallback(null, {
|
||||
data: {
|
||||
message: 'Workflow executed sucessfully.',
|
||||
message: 'Workflow executed sucessfully',
|
||||
},
|
||||
responseCode,
|
||||
});
|
||||
@@ -512,8 +512,7 @@ export async function executeWebhook(
|
||||
if (!didSendResponse) {
|
||||
responseCallback(null, {
|
||||
data: {
|
||||
message:
|
||||
'Workflow did execute sucessfully but the last node did not return any data.',
|
||||
message: 'Workflow executed sucessfully but the last node did not return any data',
|
||||
},
|
||||
responseCode,
|
||||
});
|
||||
@@ -533,7 +532,7 @@ export async function executeWebhook(
|
||||
// Return the JSON data of the first entry
|
||||
|
||||
if (returnData.data!.main[0]![0] === undefined) {
|
||||
responseCallback(new Error('No item to return got found.'), {});
|
||||
responseCallback(new Error('No item to return got found'), {});
|
||||
didSendResponse = true;
|
||||
return undefined;
|
||||
}
|
||||
@@ -587,13 +586,13 @@ export async function executeWebhook(
|
||||
data = returnData.data!.main[0]![0];
|
||||
|
||||
if (data === undefined) {
|
||||
responseCallback(new Error('No item to return got found.'), {});
|
||||
responseCallback(new Error('No item was found to return'), {});
|
||||
didSendResponse = true;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (data.binary === undefined) {
|
||||
responseCallback(new Error('No binary data to return got found.'), {});
|
||||
responseCallback(new Error('No binary data was found to return'), {});
|
||||
didSendResponse = true;
|
||||
return undefined;
|
||||
}
|
||||
@@ -608,7 +607,7 @@ export async function executeWebhook(
|
||||
);
|
||||
|
||||
if (responseBinaryPropertyName === undefined && !didSendResponse) {
|
||||
responseCallback(new Error('No "responseBinaryPropertyName" is set.'), {});
|
||||
responseCallback(new Error("No 'responseBinaryPropertyName' is set"), {});
|
||||
didSendResponse = true;
|
||||
}
|
||||
|
||||
@@ -618,7 +617,7 @@ export async function executeWebhook(
|
||||
if (binaryData === undefined && !didSendResponse) {
|
||||
responseCallback(
|
||||
new Error(
|
||||
`The binary property "${responseBinaryPropertyName}" which should be returned does not exist.`,
|
||||
`The binary property '${responseBinaryPropertyName}' which should be returned does not exist`,
|
||||
),
|
||||
{},
|
||||
);
|
||||
@@ -661,7 +660,7 @@ export async function executeWebhook(
|
||||
})
|
||||
.catch((e) => {
|
||||
if (!didSendResponse) {
|
||||
responseCallback(new Error('There was a problem executing the workflow.'), {});
|
||||
responseCallback(new Error('There was a problem executing the workflow'), {});
|
||||
}
|
||||
|
||||
throw new ResponseHelper.ResponseError(e.message, 500, 500);
|
||||
@@ -671,7 +670,7 @@ export async function executeWebhook(
|
||||
return executionId;
|
||||
} catch (e) {
|
||||
if (!didSendResponse) {
|
||||
responseCallback(new Error('There was a problem executing the workflow.'), {});
|
||||
responseCallback(new Error('There was a problem executing the workflow'), {});
|
||||
}
|
||||
|
||||
throw new ResponseHelper.ResponseError(e.message, 500, 500);
|
||||
|
||||
Reference in New Issue
Block a user