From bf22dd75ad7a44fb6293a5a214e3d06fd14e57be Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Sat, 24 Jan 2026 02:13:06 -0800 Subject: [PATCH] address bugbot comments --- apps/sim/executor/utils/errors.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/sim/executor/utils/errors.ts b/apps/sim/executor/utils/errors.ts index 3144d9c71..f92c9c1ff 100644 --- a/apps/sim/executor/utils/errors.ts +++ b/apps/sim/executor/utils/errors.ts @@ -11,14 +11,20 @@ export interface ErrorWithExecutionResult extends Error { /** * Type guard to check if an error carries an ExecutionResult. + * Validates that executionResult has required fields (success, output). */ export function hasExecutionResult(error: unknown): error is ErrorWithExecutionResult { - return ( - error instanceof Error && - 'executionResult' in error && - error.executionResult != null && - typeof error.executionResult === 'object' - ) + if ( + !(error instanceof Error) || + !('executionResult' in error) || + error.executionResult == null || + typeof error.executionResult !== 'object' + ) { + return false + } + + const result = error.executionResult as Record + return typeof result.success === 'boolean' && result.output != null } /**