summaryrefslogtreecommitdiff
path: root/packages/astro-rss/src
diff options
context:
space:
mode:
authorGravatar Vlad Esafev <artmare@me.com> 2022-07-19 02:01:04 +0400
committerGravatar GitHub <noreply@github.com> 2022-07-18 15:01:04 -0700
commit57e529e4c13f3e7829311ac6f92682eb6333fd96 (patch)
tree51e8a8abc12a349de8b91d6593a35b28e810f0e1 /packages/astro-rss/src
parent72e777aad88a6c7946bf07abba849ed93d70bcb8 (diff)
downloadastro-57e529e4c13f3e7829311ac6f92682eb6333fd96.tar.gz
astro-57e529e4c13f3e7829311ac6f92682eb6333fd96.tar.zst
astro-57e529e4c13f3e7829311ac6f92682eb6333fd96.zip
Throw the error when `site` option is missing (#3956)
* Throw the error when site option is missing * Update index.ts * Update index.ts * Update rss.test.js * Update index.ts Co-authored-by: Fred K. Schott <fkschott@gmail.com>
Diffstat (limited to 'packages/astro-rss/src')
-rw-r--r--packages/astro-rss/src/index.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/astro-rss/src/index.ts b/packages/astro-rss/src/index.ts
index d715b7dc0..9f55ee9f1 100644
--- a/packages/astro-rss/src/index.ts
+++ b/packages/astro-rss/src/index.ts
@@ -76,10 +76,17 @@ function mapGlobResult(items: GlobResult): Promise<RSSFeedItem[]> {
}
export default async function getRSS(rssOptions: RSSOptions) {
+ const { site } = rssOptions;
let { items } = rssOptions;
+
+ if (!site) {
+ throw new Error('[RSS] the "site" option is required, but no value was given.');
+ }
+
if (isGlobResult(items)) {
items = await mapGlobResult(items);
}
+
return {
body: await generateRSS({
rssOptions,