Skip to content

Commit 8f40319

Browse files
committed
fix: throw error for invalid type matching
handles cases where fetch returns html, but invalid RSS/XML feed
1 parent 0a7e55b commit 8f40319

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib/api/fetchRSS.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ export const fetchRSS = async (xmlUrl: string | string[]) => {
115115
})
116116

117117
allItems.push(parsedAtomItems)
118+
} else {
119+
throw new Error(
120+
`Error parsing XML, invalid RSSResult or AtomResult type: ${url}`
121+
)
118122
}
119123
} catch (error) {
120124
console.error(error instanceof Error ? error.message : error)

0 commit comments

Comments
 (0)