refactor(core): Enable useUnknownInCatchVariables in workflow package (no-changelog) (#7549)

This commit is contained in:
Iván Ovejero 2023-10-31 13:59:33 +01:00 committed by GitHub
parent b350568505
commit c6b688387c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 10 deletions

View file

@ -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.`,

View file

@ -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"]
}