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>
This commit is contained in:
liruifengv 2025-01-10 17:44:17 +08:00 committed by GitHub
parent 2f9ba982fe
commit f00c2ddc31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Improves the session error messages

View file

@ -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;