File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff 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 */
1516export 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/**
You can’t perform that action at this time.
0 commit comments