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,
|
INodePropertyCollection,
|
||||||
NodeParameterValueType,
|
NodeParameterValueType,
|
||||||
PostReceiveAction,
|
PostReceiveAction,
|
||||||
|
JsonObject,
|
||||||
} from './Interfaces';
|
} from './Interfaces';
|
||||||
|
import type { NodeError } from './NodeErrors';
|
||||||
import { NodeApiError, NodeOperationError } from './NodeErrors';
|
import { NodeApiError, NodeOperationError } from './NodeErrors';
|
||||||
import * as NodeHelpers from './NodeHelpers';
|
import * as NodeHelpers from './NodeHelpers';
|
||||||
|
|
||||||
|
@ -211,16 +213,29 @@ export class RoutingNode {
|
||||||
returnData.push(...responseData);
|
returnData.push(...responseData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (thisArgs !== undefined && thisArgs.continueOnFail()) {
|
if (thisArgs !== undefined && thisArgs.continueOnFail()) {
|
||||||
returnData.push({ json: {}, error: error.message });
|
returnData.push({ json: {}, error: error as NodeError });
|
||||||
continue;
|
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,
|
runIndex,
|
||||||
itemIndex: i,
|
itemIndex: i,
|
||||||
message: error?.message,
|
message: routingError?.message,
|
||||||
description: error?.description,
|
description: routingError?.description,
|
||||||
httpCode: error.isAxiosError && error.response && String(error.response?.status),
|
httpCode:
|
||||||
|
routingError.isAxiosError && routingError.response
|
||||||
|
? String(routingError.response?.status)
|
||||||
|
: 'none',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,7 +291,7 @@ export class RoutingNode {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new NodeOperationError(this.node, error, {
|
throw new NodeOperationError(this.node, error as Error, {
|
||||||
runIndex,
|
runIndex,
|
||||||
itemIndex,
|
itemIndex,
|
||||||
description: `The rootProperty "${action.properties.property}" could not be found on item.`,
|
description: `The rootProperty "${action.properties.property}" could not be found on item.`,
|
||||||
|
|
|
@ -7,9 +7,7 @@
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./*"]
|
"@/*": ["./*"]
|
||||||
},
|
},
|
||||||
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo",
|
"tsBuildInfoFile": "dist/typecheck.tsbuildinfo"
|
||||||
// TODO: remove all options below this line
|
|
||||||
"useUnknownInCatchVariables": false
|
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "test/**/*.ts"]
|
"include": ["src/**/*.ts", "test/**/*.ts"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue