Skip to content

Commit 7142a0a

Browse files
committed
Revert "revert: throwing error on few rss items"
This reverts commit 360c439.
1 parent 360c439 commit 7142a0a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib/api/fetchRSS.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { parseString } from "xml2js"
22

3+
import { RSS_DISPLAY_COUNT } from "../constants"
34
import type { AtomElement, AtomResult, RSSItem, RSSResult } from "../types"
45
import { isValidDate } from "../utils/date"
56

@@ -124,6 +125,10 @@ export const fetchRSS = async (xmlUrl: string | string[]) => {
124125
continue
125126
}
126127
}
128+
129+
if (allItems.length < RSS_DISPLAY_COUNT)
130+
throw new Error("Insufficient number of RSS items fetched")
131+
127132
return allItems
128133
}
129134

0 commit comments

Comments
 (0)