()
| 128 | } |
| 129 | |
| 130 | async *streamIterator() { |
| 131 | this.reset() |
| 132 | |
| 133 | // Loop to handle iteration |
| 134 | while (true) { |
| 135 | try { |
| 136 | if (this.iterations === 0) { |
| 137 | await this.onFirstStep() |
| 138 | } |
| 139 | |
| 140 | const result = await this._callNext() |
| 141 | yield result |
| 142 | } catch (e: any) { |
| 143 | if ('message' in e && e.message.startsWith('Final outputs already reached: ')) { |
| 144 | if (!this.finalOutputs) { |
| 145 | throw e |
| 146 | } |
| 147 | return this.finalOutputs |
| 148 | } |
| 149 | if (this.runManager) { |
| 150 | await this.runManager.handleChainError(e) |
| 151 | } |
| 152 | throw e |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * Perform any necessary setup for the first step |
no test coverage detected