mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix: Always retain original errors in the error chain on NodeOperationError (#4951)
This commit is contained in:
parent
323bd78067
commit
231257d081
|
@ -604,7 +604,7 @@ export class FileMaker implements INodeType {
|
||||||
try {
|
try {
|
||||||
returnData = await layoutsApiRequest.call(this);
|
returnData = await layoutsApiRequest.call(this);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new NodeOperationError(this.getNode(), `FileMaker Error: ${error}`);
|
throw new NodeOperationError(this.getNode(), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnData;
|
return returnData;
|
||||||
|
@ -620,7 +620,7 @@ export class FileMaker implements INodeType {
|
||||||
try {
|
try {
|
||||||
layouts = await layoutsApiRequest.call(this);
|
layouts = await layoutsApiRequest.call(this);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new NodeOperationError(this.getNode(), `FileMaker Error: ${error}`);
|
throw new NodeOperationError(this.getNode(), error);
|
||||||
}
|
}
|
||||||
for (const layout of layouts) {
|
for (const layout of layouts) {
|
||||||
returnData.push({
|
returnData.push({
|
||||||
|
@ -638,7 +638,7 @@ export class FileMaker implements INodeType {
|
||||||
try {
|
try {
|
||||||
fields = await getFields.call(this);
|
fields = await getFields.call(this);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new NodeOperationError(this.getNode(), `FileMaker Error: ${error}`);
|
throw new NodeOperationError(this.getNode(), error);
|
||||||
}
|
}
|
||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
returnData.push({
|
returnData.push({
|
||||||
|
@ -656,7 +656,7 @@ export class FileMaker implements INodeType {
|
||||||
try {
|
try {
|
||||||
scripts = await getScripts.call(this);
|
scripts = await getScripts.call(this);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new NodeOperationError(this.getNode(), `FileMaker Error: ${error}`);
|
throw new NodeOperationError(this.getNode(), error);
|
||||||
}
|
}
|
||||||
for (const script of scripts) {
|
for (const script of scripts) {
|
||||||
if (!script.isFolder) {
|
if (!script.isFolder) {
|
||||||
|
@ -676,7 +676,7 @@ export class FileMaker implements INodeType {
|
||||||
try {
|
try {
|
||||||
portals = await getPortals.call(this);
|
portals = await getPortals.call(this);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new NodeOperationError(this.getNode(), `FileMaker Error: ${error}`);
|
throw new NodeOperationError(this.getNode(), error);
|
||||||
}
|
}
|
||||||
Object.keys(portals).forEach((portal) => {
|
Object.keys(portals).forEach((portal) => {
|
||||||
returnData.push({
|
returnData.push({
|
||||||
|
@ -700,7 +700,7 @@ export class FileMaker implements INodeType {
|
||||||
try {
|
try {
|
||||||
token = await getToken.call(this);
|
token = await getToken.call(this);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new NodeOperationError(this.getNode(), `Login fail: ${error}`);
|
throw new NodeOperationError(this.getNode(), new Error('Login fail', { cause: error }));
|
||||||
}
|
}
|
||||||
|
|
||||||
let requestOptions: OptionsWithUri;
|
let requestOptions: OptionsWithUri;
|
||||||
|
|
|
@ -426,7 +426,7 @@ export class JiraTrigger implements INodeType {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new NodeOperationError(
|
throw new NodeOperationError(
|
||||||
this.getNode(),
|
this.getNode(),
|
||||||
`Could not retrieve HTTP Query Auth credentials: ${e}`,
|
new Error('Could not retrieve HTTP Query Auth credentials', { cause: e }),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!httpQueryAuth.name && !httpQueryAuth.value) {
|
if (!httpQueryAuth.name && !httpQueryAuth.value) {
|
||||||
|
|
|
@ -166,7 +166,9 @@ export const parseAndSetBodyJson = (
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new NodeOperationError(
|
throw new NodeOperationError(
|
||||||
this.getNode(),
|
this.getNode(),
|
||||||
`The '${parameterName}' property must be valid JSON, but cannot be parsed: ${err}`,
|
new Error(`The '${parameterName}' property must be valid JSON, but cannot be parsed`, {
|
||||||
|
cause: err,
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return requestOptions;
|
return requestOptions;
|
||||||
|
|
|
@ -180,7 +180,10 @@ export class NocoDB implements INodeType {
|
||||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, {}, {});
|
const responseData = await apiRequest.call(this, requestMethod, endpoint, {}, {});
|
||||||
return responseData.list.map((i: IDataObject) => ({ name: i.title, value: i.id }));
|
return responseData.list.map((i: IDataObject) => ({ name: i.title, value: i.id }));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new NodeOperationError(this.getNode(), `Error while fetching projects! (${e})`);
|
throw new NodeOperationError(
|
||||||
|
this.getNode(),
|
||||||
|
new Error('Error while fetching projects!', { cause: e }),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// This only supports using the Project ID
|
// This only supports using the Project ID
|
||||||
|
@ -193,7 +196,10 @@ export class NocoDB implements INodeType {
|
||||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, {}, {});
|
const responseData = await apiRequest.call(this, requestMethod, endpoint, {}, {});
|
||||||
return responseData.list.map((i: IDataObject) => ({ name: i.title, value: i.id }));
|
return responseData.list.map((i: IDataObject) => ({ name: i.title, value: i.id }));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new NodeOperationError(this.getNode(), `Error while fetching tables! (${e})`);
|
throw new NodeOperationError(
|
||||||
|
this.getNode(),
|
||||||
|
new Error('Error while fetching tables!', { cause: e }),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new NodeOperationError(this.getNode(), `No project selected!`);
|
throw new NodeOperationError(this.getNode(), `No project selected!`);
|
||||||
|
|
|
@ -104,7 +104,7 @@ export namespace SendInBlueNode {
|
||||||
|
|
||||||
return requestOptions;
|
return requestOptions;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new NodeOperationError(this.getNode(), `${err}`);
|
throw new NodeOperationError(this.getNode(), err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue