mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08:00
⚡ Display correct error message if there is no item to return
This commit is contained in:
parent
f145c499c0
commit
daaee2e039
|
@ -294,6 +294,12 @@ export function getWorkflowWebhooks(workflow: Workflow, additionalData: IWorkflo
|
|||
|
||||
if (responseData === 'firstEntryJson') {
|
||||
// Return the JSON data of the first entry
|
||||
|
||||
if (returnData.data!.main[0]![0] === undefined) {
|
||||
responseCallback(new Error('No item to return got found.'), {});
|
||||
didSendResponse = true;
|
||||
}
|
||||
|
||||
data = returnData.data!.main[0]![0].json;
|
||||
|
||||
const responsePropertyName = workflow.getSimpleParameterValue(workflowStartNode, webhookData.webhookDescription['responsePropertyName'], undefined);
|
||||
|
@ -324,6 +330,12 @@ export function getWorkflowWebhooks(workflow: Workflow, additionalData: IWorkflo
|
|||
} else if (responseData === 'firstEntryBinary') {
|
||||
// Return the binary data of the first entry
|
||||
data = returnData.data!.main[0]![0];
|
||||
|
||||
if (data === undefined) {
|
||||
responseCallback(new Error('No item to return got found.'), {});
|
||||
didSendResponse = true;
|
||||
}
|
||||
|
||||
if (data.binary === undefined) {
|
||||
responseCallback(new Error('No binary data to return got found.'), {});
|
||||
didSendResponse = true;
|
||||
|
|
Loading…
Reference in a new issue