summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar liruifengv <liruifeng1024@gmail.com> 2025-01-10 17:44:17 +0800
committerGravatar GitHub <noreply@github.com> 2025-01-10 09:44:17 +0000
commitf00c2ddc31b5285d14c2f0808c01eafaaf31f5c9 (patch)
tree5a01fa84bff26a0bb89b2ca730c8d077f33e8bee
parent2f9ba982fe5cf74aacee9e55c0f86df52e335710 (diff)
downloadastro-f00c2ddc31b5285d14c2f0808c01eafaaf31f5c9.tar.gz
astro-f00c2ddc31b5285d14c2f0808c01eafaaf31f5c9.tar.zst
astro-f00c2ddc31b5285d14c2f0808c01eafaaf31f5c9.zip
fix(errors): fix error messages rendering incorrectly (#12942)
* fix(errors): fix error messages rendering incorrectly * fix(errors): fix error messages rendering incorrectly * add `@message` for jsdoc * Create tame-hats-kiss.md --------- Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
-rw-r--r--.changeset/tame-hats-kiss.md5
-rw-r--r--packages/astro/src/core/errors/errors-data.ts6
2 files changed, 9 insertions, 2 deletions
diff --git a/.changeset/tame-hats-kiss.md b/.changeset/tame-hats-kiss.md
new file mode 100644
index 000000000..5b634a73d
--- /dev/null
+++ b/.changeset/tame-hats-kiss.md
@@ -0,0 +1,5 @@
+---
+"astro": patch
+---
+
+Improves the session error messages
diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts
index 2fde7bbac..251063621 100644
--- a/packages/astro/src/core/errors/errors-data.ts
+++ b/packages/astro/src/core/errors/errors-data.ts
@@ -870,6 +870,7 @@ export const AstroResponseHeadersReassigned = {
/**
* @docs
+ * @message Error when initializing session storage with driver `DRIVER`. `ERROR`
* @see
* - [experimental.session](https://docs.astro.build/en/reference/experimental-flags/sessions/)
* @description
@@ -879,12 +880,13 @@ export const SessionStorageInitError = {
name: 'SessionStorageInitError',
title: 'Session storage could not be initialized.',
message: (error: string, driver?: string) =>
- `Error when initializing session storage${driver ? ` with driver ${driver}` : ''}. ${error ?? ''}`,
+ `Error when initializing session storage${driver ? ` with driver \`${driver}\`` : ''}. \`${error ?? ''}\``,
hint: 'For more information, see https://docs.astro.build/en/reference/experimental-flags/sessions/',
} satisfies ErrorData;
/**
* @docs
+ * @message Error when saving session data with driver `DRIVER`. `ERROR`
* @see
* - [experimental.session](https://docs.astro.build/en/reference/experimental-flags/sessions/)
* @description
@@ -894,7 +896,7 @@ export const SessionStorageSaveError = {
name: 'SessionStorageSaveError',
title: 'Session data could not be saved.',
message: (error: string, driver?: string) =>
- `Error when saving session data${driver ? ` with driver ${driver}` : ''}. ${error ?? ''}`,
+ `Error when saving session data${driver ? ` with driver \`${driver}\`` : ''}. \`${error ?? ''}\``,
hint: 'For more information, see https://docs.astro.build/en/reference/experimental-flags/sessions/',
} satisfies ErrorData;