Skip to content

Commit 2ea65fc

Browse files
authored
Jimmy/fix type check (#1129)
* fix: type check backend in semantic search branch * fix: solve fromat error * fix: lint error * fix: solve format error
1 parent 4ba1cd2 commit 2ea65fc

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

apps/backend/src/modules/semantic-search/client.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,17 @@ export async function searchSemantic(
4141
if (!response.ok) {
4242
let detail: string | undefined;
4343
try {
44-
const body = await response.json();
44+
const body = (await response.json()) as {
45+
detail?: string;
46+
error?: string;
47+
};
4548
detail = body?.detail ?? body?.error;
46-
} catch {}
47-
throw new Error(detail ?? `Semantic search service error: ${response.statusText}`);
49+
} catch {
50+
/* ignore parse errors */
51+
}
52+
throw new Error(
53+
detail ?? `Semantic search service error: ${response.statusText}`
54+
);
4855
}
4956

5057
return (await response.json()) as SemanticSearchResponse;

0 commit comments

Comments
 (0)