Skip to content

Commit 82c10de

Browse files
committed
[sc-12927] resolve coderabbit PR reviews
1 parent 1de69c4 commit 82c10de

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/ai-answers-api.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class CallbackThrottler {
9090
private throttleTimeout: ReturnType<typeof setTimeout> | null = null;
9191
private pendingCallback = false;
9292

93-
constructor(private cb: ApiFetchCallback<AiAnswersResponse>) {}
93+
constructor(private readonly cb: ApiFetchCallback<AiAnswersResponse>) {}
9494

9595
/**
9696
* Call callback immediately, bypassing throttling
@@ -379,7 +379,12 @@ const executeNonStreamingAiAnswers = (
379379
filter: settings?.aiAnswersFilterObject
380380
})
381381
})
382-
.then((response) => response.json())
382+
.then((response) => {
383+
if (!response.ok) {
384+
throw new Error(`HTTP error! status: ${response.status}`);
385+
}
386+
return response.json();
387+
})
383388
.then((data: ConversationsApiResponse) => {
384389
if (data.response) {
385390
cb({

0 commit comments

Comments
 (0)