diff options
author | 2023-02-17 04:33:12 +0700 | |
---|---|---|
committer | 2023-02-16 15:33:12 -0600 | |
commit | dbffee4e381e74882734039783fae312d3893f2a (patch) | |
tree | 7e162c0dfd23e5cfef8b9b618f80a711ae58b4ff | |
parent | 17869bf749f77cb8401f7639303e8601d08f4449 (diff) | |
download | astro-dbffee4e381e74882734039783fae312d3893f2a.tar.gz astro-dbffee4e381e74882734039783fae312d3893f2a.tar.zst astro-dbffee4e381e74882734039783fae312d3893f2a.zip |
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>
-rw-r--r-- | .changeset/good-snails-attend.md | 5 | ||||
-rw-r--r-- | packages/astro-rss/src/index.ts | 12 |
2 files changed, 12 insertions, 5 deletions
diff --git a/.changeset/good-snails-attend.md b/.changeset/good-snails-attend.md new file mode 100644 index 000000000..778344037 --- /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 800db22f0..35c14f5d5 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; } |