mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Separate API response from error in execution error causes (no-changelog) (#7880)
Store the third-party API response error separately from the error stored as `cause` Follow-up to: https://github.com/n8n-io/n8n/pull/7820#discussion_r1406009154
This commit is contained in:
@@ -3,6 +3,7 @@ import type {
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { jsonParse, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
@@ -81,14 +82,14 @@ export class StopAndError implements INodeType {
|
||||
const errorType = this.getNodeParameter('errorType', 0) as 'errorMessage' | 'errorObject';
|
||||
const { id: workflowId, name: workflowName } = this.getWorkflow();
|
||||
|
||||
let toThrow: string | { name: string; message: string; [otherKey: string]: unknown };
|
||||
let toThrow: string | JsonObject;
|
||||
|
||||
if (errorType === 'errorMessage') {
|
||||
toThrow = this.getNodeParameter('errorMessage', 0) as string;
|
||||
} else {
|
||||
const json = this.getNodeParameter('errorObject', 0) as string;
|
||||
|
||||
const errorObject = jsonParse<any>(json);
|
||||
const errorObject = jsonParse<JsonObject>(json);
|
||||
|
||||
toThrow = {
|
||||
name: 'User-thrown error',
|
||||
|
||||
Reference in New Issue
Block a user