Repository: withastro/astro
File: packages/astro/src/core/errors/errors-data.ts (TypeScript)

Code before:
 * @description
 * Action called from a server page or endpoint without using `Astro.callAction()`.
 */
export const ActionCalledFromServerError = {
	name: 'ActionCalledFromServerError',
	title: 'Action unexpected called from the server.',
	message:
		'Action called from a server page or endpoint without using `Astro.callAction()`. This wrapper must be used to call actions from server code.',
	hint: 'See the `Astro.callAction()` reference for usage examples: https://docs.astro.build/en/reference/api-reference/#callaction',
} satisfies ErrorData;

// Generic catch-all - Only use this in extreme cases, like if there was a cosmic ray bit flip.
export const UnknownError = { name: 'UnknownError', title: 'Unknown Error.' } satisfies ErrorData;

/**
 * @docs
 * @kind heading
 * @name Session Errors
 */
// Session Errors
/**
 * @docs
 * @see
 * - [Server output adapter feature](https://docs.astro.build/en/reference/adapter-reference/#building-an-adapter)
 * @description
 * Your project must have a server output to use sessions.
 */
export const SessionWithoutServerStaticOutputError = {
	name: 'SessionWithoutServerStaticOutputError',
	title: 'Sessions cannot be used with an adapter that doesn\'t support server output.',
	message: 'Sessions require an adapter that supports server output. The adapter must set `"server"` in the `buildOutput` adapter feature.',
	hint: 'Ensure your adapter supports `buildOutput: "server"`: https://docs.astro.build/en/reference/adapter-reference/#building-an-adapter',
} satisfies ErrorData;

/**
 * @docs
 * @message Error when initializing session storage with driver `DRIVER`. `ERROR`
 * @see
 * 	- [experimental.session](https://docs.astro.build/en/reference/experimental-flags/sessions/)
 * @description
 * Thrown when the session storage could not be initialized.
 */
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 ?? ''}\``,
	hint: 'For more information, see https://docs.astro.build/en/reference/experimental-flags/sessions/',
} satisfies ErrorData;

/**

Review comment (suggestion):
```suggestion
 * Your adapter must support server output to use sessions.
```

Code after:
 * @description
 * Action called from a server page or endpoint without using `Astro.callAction()`.
 */
export const ActionCalledFromServerError = {
	name: 'ActionCalledFromServerError',
	title: 'Action unexpected called from the server.',
	message:
		'Action called from a server page or endpoint without using `Astro.callAction()`. This wrapper must be used to call actions from server code.',
	hint: 'See the `Astro.callAction()` reference for usage examples: https://docs.astro.build/en/reference/api-reference/#callaction',
} satisfies ErrorData;

// Generic catch-all - Only use this in extreme cases, like if there was a cosmic ray bit flip.
export const UnknownError = { name: 'UnknownError', title: 'Unknown Error.' } satisfies ErrorData;

/**
 * @docs
 * @kind heading
 * @name Session Errors
 */
// Session Errors
/**
 * @docs
 * @see
 * - [Server output adapter feature](https://docs.astro.build/en/reference/adapter-reference/#building-an-adapter)
 * @description
 * Your adapter must support server output to use sessions.
 */
export const SessionWithoutSupportedAdapterOutputError = {
	name: 'SessionWithoutSupportedAdapterOutputError',
	title: 'Sessions cannot be used with an adapter that doesn\'t support server output.',
	message: 'Sessions require an adapter that supports server output. The adapter must set `"server"` in the `buildOutput` adapter feature.',
	hint: 'Ensure your adapter supports `buildOutput: "server"`: https://docs.astro.build/en/reference/adapter-reference/#building-an-adapter',
} satisfies ErrorData;

/**
 * @docs
 * @message Error when initializing session storage with driver `DRIVER`. `ERROR`
 * @see
 * 	- [experimental.session](https://docs.astro.build/en/reference/experimental-flags/sessions/)
 * @description
 * Thrown when the session storage could not be initialized.
 */
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 ?? ''}\``,
	hint: 'For more information, see https://docs.astro.build/en/reference/experimental-flags/sessions/',
} satisfies ErrorData;

/**