Skip to content

Commit

Permalink
feat: handle remote errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lucgagan committed Jun 2, 2023
1 parent 420e840 commit 125e20b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/createCompletions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const createCompletions = async (
// "code": "context_length_exceeded"
// }
// }
if (value.startsWith('{')) {
if (value.startsWith("{")) {
await reader.cancel();

// As far as I can tell, if the response is an object, then it is an unrecoverable error.
Expand Down
2 changes: 1 addition & 1 deletion src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export class UnrecoverableRemoteError extends CustomError {
public constructor(public error: string) {
super("Server responded with an error");
}
}
}

0 comments on commit 125e20b

Please sign in to comment.