(error: unknown, context: ExpectedControlFlowErrorContext)
| 104 | * fatal failures while handling stdin stream tasks. |
| 105 | */ |
| 106 | export function isExpectedControlFlowError(error: unknown, context: ExpectedControlFlowErrorContext): boolean { |
| 107 | if (!context.stdinStreamMode) { |
| 108 | return false |
| 109 | } |
| 110 | |
| 111 | if (context.shuttingDown && isStreamTeardownLikeError(error)) { |
| 112 | return true |
| 113 | } |
| 114 | |
| 115 | const isCancelLike = isCancellationLikeError(error) |
| 116 | if (isCancelLike && (context.cancelRequested || context.shuttingDown || context.operation === "runtime")) { |
| 117 | return true |
| 118 | } |
| 119 | |
| 120 | if ( |
| 121 | isNoActiveTaskLikeError(error) && |
| 122 | (context.cancelRequested || |
| 123 | context.shuttingDown || |
| 124 | context.operation === "cancel" || |
| 125 | context.operation === "shutdown") |
| 126 | ) { |
| 127 | return true |
| 128 | } |
| 129 | |
| 130 | return false |
| 131 | } |
no test coverage detected