From dbffee4e381e74882734039783fae312d3893f2a Mon Sep 17 00:00:00 2001 From: Julien Barbay Date: Fri, 17 Feb 2023 04:33:12 +0700 Subject: [PATCH] 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 --- .changeset/good-snails-attend.md | 5 +++++ packages/astro-rss/src/index.ts | 12 +++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 .changeset/good-snails-attend.md diff --git a/.changeset/good-snails-attend.md b/.changeset/good-snails-attend.md new file mode 100644 index 000000000000..77834403723d --- /dev/null +++ b/.changeset/good-snails-attend.md @@ -0,0 +1,5 @@ +--- +"@astrojs/rss": patch +--- + +Improve RSS schema errors with additional property name context diff --git a/packages/astro-rss/src/index.ts b/packages/astro-rss/src/index.ts index 800db22f0671..35c14f5d5756 100644 --- a/packages/astro-rss/src/index.ts +++ b/packages/astro-rss/src/index.ts @@ -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; }