fix(HTTP Request Node): Show error cause in the output (#4538)

fix (HTTP Request node): show error cause in the output

This broke in these two PRs

https://github.com/n8n-io/n8n/pull/4505/
https://github.com/n8n-io/n8n/pull/4431/
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2022-11-07 18:40:54 +01:00 committed by GitHub
parent 157e8e0cc8
commit c239eea1b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,6 +63,8 @@ interface ExecutionBaseErrorOptions {
export abstract class ExecutionBaseError extends Error { export abstract class ExecutionBaseError extends Error {
description: string | null | undefined; description: string | null | undefined;
cause: Error | JsonObject | undefined;
timestamp: number; timestamp: number;
context: IDataObject = {}; context: IDataObject = {};
@ -78,6 +80,8 @@ export abstract class ExecutionBaseError extends Error {
if (cause instanceof ExecutionBaseError) { if (cause instanceof ExecutionBaseError) {
this.context = cause.context; this.context = cause.context;
} else if (cause && !(cause instanceof Error)) {
this.cause = cause;
} }
} }
} }
@ -179,7 +183,6 @@ abstract class NodeError extends ExecutionBaseError {
value && value &&
typeof value === 'object' && typeof value === 'object' &&
!Array.isArray(value) && !Array.isArray(value) &&
typeof value.toJSON !== 'function' &&
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
!!Object.keys(value).length !!Object.keys(value).length
); );