(error: unknown)
| 14 | * Validates that executionResult has required fields (success, output). |
| 15 | */ |
| 16 | export function hasExecutionResult(error: unknown): error is ErrorWithExecutionResult { |
| 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 |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Attaches an ExecutionResult to an error for propagation to parent workflows. |
no outgoing calls
no test coverage detected