Skip to content

Commit f48d079

Browse files
authored
feat(websearch): skip pages that dont return success (#1639)
1 parent c135e93 commit f48d079

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/lib/server/websearch/scrape/scrape.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const scrape = (maxCharsPerElem: number) =>
3535
export async function scrapeUrl(url: string, maxCharsPerElem: number) {
3636
return withPage(url, async (page, res) => {
3737
if (!res) throw Error("Failed to load page");
38+
if (!res.ok()) throw Error(`Failed to load page: ${res.status()}`);
3839

3940
// Check if it's a non-html content type that we can handle directly
4041
// TODO: direct mappings to markdown can be added for markdown, csv and others

0 commit comments

Comments
 (0)