Pull `{ message, code }` off a RUN_ERROR chunk for the run record.
(
chunk: StreamChunk & { message: string; code?: string },
)
| 23 | |
| 24 | /** Pull `{ message, code }` off a RUN_ERROR chunk for the run record. */ |
| 25 | function runErrorFromChunk( |
| 26 | chunk: StreamChunk & { message: string; code?: string }, |
| 27 | ): RunError { |
| 28 | return chunk.code !== undefined |
| 29 | ? { message: chunk.message, code: chunk.code } |
| 30 | : { message: chunk.message } |
| 31 | } |
| 32 | |
| 33 | /** Render an unknown thrown value as a stable error message. */ |
| 34 | function messageOf(error: unknown): string { |