Skip to content

Commit

Permalink
fix(runtimes/ecge): catch HTTP errors (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Jul 15, 2024
1 parent 77a45a6 commit 6e0370a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/react/src/runtimes/edge/EdgeChatAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ export class EdgeChatAdapter implements ChatModelAdapter {
signal: abortSignal,
});

if (result.status !== 200) {
throw new Error(
`Edge runtime returned status ${result.status}: ${await result.text()}`,
);
}

const stream = result
.body!.pipeThrough(new TextDecoderStream())
.pipeThrough(chunkByLineStream())
Expand Down

0 comments on commit 6e0370a

Please sign in to comment.