Skip to content

Commit

Permalink
fix: add property name to rss errors (withastro#6259)
Browse files Browse the repository at this point in the history
* fix: add property name to rss errors

* Create good-snails-attend.md

---------

Co-authored-by: Nate Moore <[email protected]>
  • Loading branch information
y-nk and natemoo-re committed Feb 16, 2023
1 parent 17869bf commit dbffee4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-snails-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/rss": patch
---

Improve RSS schema errors with additional property name context
12 changes: 7 additions & 5 deletions packages/astro-rss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ async function validateRssOptions(rssOptions: RSSOptions) {
return parsedResult.data;
}
const formattedError = new Error(
[
`[RSS] Invalid or missing options:`,
...parsedResult.error.errors.map((zodError) => zodError.message),
].join('\n')
);
[
`[RSS] Invalid or missing options:`,
...parsedResult.error.errors.map(
zodError => `${zodError.message} (${zodError.path.join('.')})`
),
].join('\n')
)
throw formattedError;
}

Expand Down

0 comments on commit dbffee4

Please sign in to comment.