fix: Always retain original errors in the error chain on NodeOperationError (#4951)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2022-12-16 18:47:20 +01:00
committed by GitHub
parent 323bd78067
commit 231257d081
5 changed files with 19 additions and 11 deletions

View File

@@ -180,7 +180,10 @@ export class NocoDB implements INodeType {
const responseData = await apiRequest.call(this, requestMethod, endpoint, {}, {});
return responseData.list.map((i: IDataObject) => ({ name: i.title, value: i.id }));
} 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
@@ -193,7 +196,10 @@ export class NocoDB implements INodeType {
const responseData = await apiRequest.call(this, requestMethod, endpoint, {}, {});
return responseData.list.map((i: IDataObject) => ({ name: i.title, value: i.id }));
} 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 {
throw new NodeOperationError(this.getNode(), `No project selected!`);