fix(routing): improve error handling#14161
Conversation
🦋 Changeset detectedLatest commit: 9bdc5ad The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #14161 will not alter performanceComparing Summary
Footnotes |
df7778d to
942a721
Compare
942a721 to
37e57c5
Compare
ascorbic
left a comment
There was a problem hiding this comment.
What would be the behaviour now, if one of these invalid redirects was created?
As mentioned in the bug report, the error is generic: |
Co-authored-by: Matt Kane <m@mk.gg>
|
This still doesn't test for the example in the issue, and I'm not sure it would catch it. The original had the same number of dynamic segments on each side: redirects: {
'/categories/[category]': '/category/[category]/1',
} |
|
Sorry, I missed that. I'll add a test for that too |
|
@ematipico what are your plans for this PR? |
|
@florian-lefebvre It requires some thinking about how to catch the edge case and throw an error. Unfortunately I'm focused on other things, and jumping on this one again would require some time to fix |
|
Closing due to inactivity, I assume that with Astro 6 this might require some code change as well. |
Changes
Closes #12036
Astro didn't perform any validation of the route mappings. This PR introduces a new function that performs this task.
An error is thrown when a redirect can't be mapped to a new route.
Testing
Added a new test
Docs