We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7fa10db commit 6b35dd9Copy full SHA for 6b35dd9
src/lib/BetaMessageStream.ts
@@ -593,7 +593,14 @@ export class BetaMessageStream implements AsyncIterable<BetaMessageStreamEvent>
593
});
594
595
if (jsonBuf) {
596
- snapshotContent.input = partialParse(jsonBuf);
+ try {
597
+ snapshotContent.input = partialParse(jsonBuf);
598
+ } catch (err) {
599
+ const error = new AnthropicError(
600
+ `Invalid JSON received in input_json_delta event.\nerror: ${err}\njson: ${jsonBuf}`,
601
+ );
602
+ this.#handleError(error);
603
+ }
604
}
605
606
break;
0 commit comments