Skip to content

Commit 6f74092

Browse files
author
Roman Snapko
committed
chore: simplify handleFailureFlow calls by removing redundant conditional logic
1 parent 1d1a4df commit 6f74092

1 file changed

Lines changed: 11 additions & 27 deletions

File tree

packages/server/worker/src/lib/trigger/hooks/extract-trigger-payload-hooks.ts

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,12 @@ export async function extractPayloads(
5050
const errorMessage =
5151
result?.message ?? 'Failed to execute trigger due to unknown error';
5252

53-
handleFailureFlow(
54-
flowVersion,
55-
projectId,
56-
engineToken,
57-
false,
58-
!simulate
59-
? {
60-
reason: 'TRIGGER_HOOK_FAILED',
61-
flowVersionId: flowVersion.id,
62-
errorMessage,
63-
triggerInput: result.input,
64-
}
65-
: undefined,
66-
);
53+
handleFailureFlow(flowVersion, projectId, engineToken, false, {
54+
reason: 'TRIGGER_HOOK_FAILED',
55+
flowVersionId: flowVersion.id,
56+
errorMessage,
57+
triggerInput: result.input,
58+
});
6759
return [];
6860
}
6961
} catch (e) {
@@ -81,19 +73,11 @@ export async function extractPayloads(
8173
'Failed to execute trigger due to timeout',
8274
);
8375

84-
handleFailureFlow(
85-
flowVersion,
86-
projectId,
87-
engineToken,
88-
false,
89-
!simulate
90-
? {
91-
reason: 'TRIGGER_TIMEOUT',
92-
flowVersionId: flowVersion.id,
93-
errorMessage: 'Trigger execution timed out',
94-
}
95-
: undefined,
96-
);
76+
handleFailureFlow(flowVersion, projectId, engineToken, false, {
77+
reason: 'TRIGGER_TIMEOUT',
78+
flowVersionId: flowVersion.id,
79+
errorMessage: 'Trigger execution timed out',
80+
});
9781
return [];
9882
}
9983
throw e;

0 commit comments

Comments
 (0)