Merge branch 'n8n-io:master' into master

This commit is contained in:
ajmeredith1200 2022-05-05 16:51:10 +01:00 committed by GitHub
commit ccbe9b7253
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -165,7 +165,7 @@ export async function executeWebhook(
workflowStartNode.typeVersion, workflowStartNode.typeVersion,
); );
if (nodeType === undefined) { 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), {}); responseCallback(new Error(errorMessage), {});
throw new ResponseHelper.ResponseError(errorMessage, 500, 500); 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 // 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) // the default that people know as early as possible (probably already testing phase)
// that something does not resolve properly. // 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), {}); responseCallback(new Error(errorMessage), {});
throw new ResponseHelper.ResponseError(errorMessage, 500, 500); throw new ResponseHelper.ResponseError(errorMessage, 500, 500);
} }
@ -329,7 +329,7 @@ export async function executeWebhook(
if (!didSendResponse) { if (!didSendResponse) {
responseCallback(null, { responseCallback(null, {
data: { data: {
message: 'Webhook call got received.', message: 'Webhook call received',
}, },
responseCode, responseCode,
}); });
@ -357,7 +357,7 @@ export async function executeWebhook(
} else { } else {
responseCallback(null, { responseCallback(null, {
data: { data: {
message: 'Workflow got started.', message: 'Workflow was started',
}, },
responseCode, responseCode,
}); });
@ -471,7 +471,7 @@ export async function executeWebhook(
if (!didSendResponse) { if (!didSendResponse) {
responseCallback(null, { responseCallback(null, {
data: { data: {
message: 'Workflow did execute sucessfully but no data got returned.', message: 'Workflow executed sucessfully but no data was returned',
}, },
responseCode, responseCode,
}); });
@ -485,7 +485,7 @@ export async function executeWebhook(
if (!didSendResponse) { if (!didSendResponse) {
responseCallback(null, { responseCallback(null, {
data: { data: {
message: 'Workflow did error.', message: 'Error in workflow',
}, },
responseCode: 500, responseCode: 500,
}); });
@ -499,7 +499,7 @@ export async function executeWebhook(
// Return an error if no Webhook-Response node did send any data // Return an error if no Webhook-Response node did send any data
responseCallback(null, { responseCallback(null, {
data: { data: {
message: 'Workflow executed sucessfully.', message: 'Workflow executed sucessfully',
}, },
responseCode, responseCode,
}); });
@ -512,8 +512,7 @@ export async function executeWebhook(
if (!didSendResponse) { if (!didSendResponse) {
responseCallback(null, { responseCallback(null, {
data: { data: {
message: message: 'Workflow executed sucessfully but the last node did not return any data',
'Workflow did execute sucessfully but the last node did not return any data.',
}, },
responseCode, responseCode,
}); });
@ -533,7 +532,7 @@ export async function executeWebhook(
// Return the JSON data of the first entry // Return the JSON data of the first entry
if (returnData.data!.main[0]![0] === undefined) { 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; didSendResponse = true;
return undefined; return undefined;
} }
@ -587,13 +586,13 @@ export async function executeWebhook(
data = returnData.data!.main[0]![0]; data = returnData.data!.main[0]![0];
if (data === undefined) { if (data === undefined) {
responseCallback(new Error('No item to return got found.'), {}); responseCallback(new Error('No item was found to return'), {});
didSendResponse = true; didSendResponse = true;
return undefined; return undefined;
} }
if (data.binary === 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; didSendResponse = true;
return undefined; return undefined;
} }
@ -608,7 +607,7 @@ export async function executeWebhook(
); );
if (responseBinaryPropertyName === undefined && !didSendResponse) { if (responseBinaryPropertyName === undefined && !didSendResponse) {
responseCallback(new Error('No "responseBinaryPropertyName" is set.'), {}); responseCallback(new Error("No 'responseBinaryPropertyName' is set"), {});
didSendResponse = true; didSendResponse = true;
} }
@ -618,7 +617,7 @@ export async function executeWebhook(
if (binaryData === undefined && !didSendResponse) { if (binaryData === undefined && !didSendResponse) {
responseCallback( responseCallback(
new Error( 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) => { .catch((e) => {
if (!didSendResponse) { 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); throw new ResponseHelper.ResponseError(e.message, 500, 500);
@ -671,7 +670,7 @@ export async function executeWebhook(
return executionId; return executionId;
} catch (e) { } catch (e) {
if (!didSendResponse) { 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); throw new ResponseHelper.ResponseError(e.message, 500, 500);