mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
refactor(core): Enable useUnknownInCatchVariables
in workflow package (no-changelog) (#7549)
This commit is contained in:
parent
b350568505
commit
c6b688387c
|
@ -35,7 +35,9 @@ import type {
|
|||
INodePropertyCollection,
|
||||
NodeParameterValueType,
|
||||
PostReceiveAction,
|
||||
JsonObject,
|
||||
} from './Interfaces';
|
||||
import type { NodeError } from './NodeErrors';
|
||||
import { NodeApiError, NodeOperationError } from './NodeErrors';
|
||||
import * as NodeHelpers from './NodeHelpers';
|
||||
|
||||
|
@ -211,16 +213,29 @@ export class RoutingNode {
|
|||
returnData.push(...responseData);
|
||||
} catch (error) {
|
||||
if (thisArgs !== undefined && thisArgs.continueOnFail()) {
|
||||
returnData.push({ json: {}, error: error.message });
|
||||
returnData.push({ json: {}, error: error as NodeError });
|
||||
continue;
|
||||
}
|
||||
if (error instanceof NodeApiError) error = error.cause;
|
||||
throw new NodeApiError(this.node, error, {
|
||||
|
||||
interface AxiosError extends NodeError {
|
||||
isAxiosError: boolean;
|
||||
description: string | undefined;
|
||||
response?: { status: number };
|
||||
}
|
||||
|
||||
let routingError = error as AxiosError;
|
||||
|
||||
if (error instanceof NodeApiError) routingError = error.cause as AxiosError;
|
||||
|
||||
throw new NodeApiError(this.node, error as JsonObject, {
|
||||
runIndex,
|
||||
itemIndex: i,
|
||||
message: error?.message,
|
||||
description: error?.description,
|
||||
httpCode: error.isAxiosError && error.response && String(error.response?.status),
|
||||
message: routingError?.message,
|
||||
description: routingError?.description,
|
||||
httpCode:
|
||||
routingError.isAxiosError && routingError.response
|
||||
? String(routingError.response?.status)
|
||||
: 'none',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -276,7 +291,7 @@ export class RoutingNode {
|
|||
});
|
||||
});
|
||||
} catch (error) {
|
||||
throw new NodeOperationError(this.node, error, {
|
||||
throw new NodeOperationError(this.node, error as Error, {
|
||||
runIndex,
|
||||
itemIndex,
|
||||
description: `The rootProperty "${action.properties.property}" could not be found on item.`,
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
},
|
||||
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo",
|
||||
// TODO: remove all options below this line
|
||||
"useUnknownInCatchVariables": false
|
||||
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo"
|
||||
},
|
||||
"include": ["src/**/*.ts", "test/**/*.ts"]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue