Replies: 2 comments
-
The public roadmap links to #951 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Could this be used to retrieve the Response status code? If a page returns new Response(null, { status: 403 }) I would like to use that info in the middleware. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Body
Summary
At the moment, Astro does not give the opportunity to use Error Types in the middlewares. Let's export types & helpers to the users. Moreover Astro shouldn't use the same error type to general rewrite pipeline error and 404.
Background & Motivation
Let's imagine I want to write custom i18n middleware which should rewrite to the same page with detected locale in
Astro.locals
.Now this code doesn't work, because
astro/error
only exportAstroError
.https://github.com/withastro/astro/blob/2da877bfe97144ff5110d011b9bfba270ccfc620/packages/astro/package.json#L78
Goals
A concise, bulleted-list outlining the intended goals of this RFC.
core/errors
/404
inside pipeline execution (with or without context dropping ctx.next('/404') or next(/404
) should be available)Beta Was this translation helpful? Give feedback.
All reactions