Skip to content

Commit bf22dd7

Browse files
committed
address bugbot comments
1 parent eb767b5 commit bf22dd7

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

apps/sim/executor/utils/errors.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,20 @@ export interface ErrorWithExecutionResult extends Error {
1111

1212
/**
1313
* Type guard to check if an error carries an ExecutionResult.
14+
* Validates that executionResult has required fields (success, output).
1415
*/
1516
export function hasExecutionResult(error: unknown): error is ErrorWithExecutionResult {
16-
return (
17-
error instanceof Error &&
18-
'executionResult' in error &&
19-
error.executionResult != null &&
20-
typeof error.executionResult === 'object'
21-
)
17+
if (
18+
!(error instanceof Error) ||
19+
!('executionResult' in error) ||
20+
error.executionResult == null ||
21+
typeof error.executionResult !== 'object'
22+
) {
23+
return false
24+
}
25+
26+
const result = error.executionResult as Record<string, unknown>
27+
return typeof result.success === 'boolean' && result.output != null
2228
}
2329

2430
/**

0 commit comments

Comments
 (0)