Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/quiet-owls-explain.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a generic "improved some astro diagnostics" (correctly worded) it's enough: https://contribute.docs.astro.build/docs-for-code-changes/changesets/#tips-and-examples

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: "Improves the diagnostics of some Astro errors."

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Improves the diagnostics of some Astro errors.
3 changes: 3 additions & 0 deletions packages/astro/src/core/errors/errors-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,8 @@ export const AstroGlobNoMatch = {
export const RedirectWithNoLocation = {
name: 'RedirectWithNoLocation',
title: 'A redirect must be given a location with the `Location` header.',
message:
'The redirect `Response` has no `Location` header. Use `Astro.redirect()` to create redirects, or add a `Location` header to the `Response`.',
} satisfies ErrorData;

/**
Expand Down Expand Up @@ -1398,6 +1400,7 @@ export const RewriteWithBodyUsed = {
title: 'Cannot use `Astro.rewrite()` after the request body has been read.',
message:
'`Astro.rewrite()` cannot be used if the request body has already been read. If you need to read the body, first clone the request.',
hint: 'Read the body from `Astro.request.clone()` instead of `Astro.request`, so the original request can still be rewritten.',
} satisfies ErrorData;

/**
Expand Down
Loading