0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix: add property name to rss errors (#6259)

* fix: add property name to rss errors

* Create good-snails-attend.md

---------

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
This commit is contained in:
Julien Barbay 2023-02-17 04:33:12 +07:00 committed by GitHub
parent 17869bf749
commit dbffee4e38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -0,0 +1,5 @@
---
"@astrojs/rss": patch
---
Improve RSS schema errors with additional property name context

View file

@ -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;
}