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

Code before:

/**
 * @docs
 * @message Session config was provided without enabling the `experimental.session` flag
 * @deprecated This error was removed in Astro 5.7, when the Sessions feature stopped being experimental.
 * @see
 * 	- [Sessions](https://docs.astro.build/en/guides/sessions/)
 * @description
 * Thrown when session storage is configured but the `experimental.session` flag is not enabled.
 */
export const SessionConfigWithoutFlagError = {
	name: 'SessionConfigWithoutFlagError',
	title: 'Session flag not set',
	message: 'Session config was provided without enabling the `experimental.session` flag',
	hint: 'For more information, see https://docs.astro.build/en/guides/sessions/',
} satisfies ErrorData;

/**
 * @docs
 * @message An error occurred while optimizing the SVG file with SVGO.
 */
export const CannotOptimizeSvg = {
	name: 'CannotOptimizeSvg',
	title: 'Cannot optimize SVG',
	message: (path: string) => `An error occurred while optimizing SVG file "${path}" with SVGO.`,
	hint: 'Review the error cause to fix this error.',
} satisfies ErrorData;

/*
 * Adding an error? Follow these steps:
 * 1. Determine in which category it belongs (Astro, Vite, CSS, Content Collections etc.)
 * 2. Add it at the bottom of the corresponding category above (see the @kind heading tags to see where they start), following the shape of the other errors.
 * 4. If your message is dynamic, make sure the function shape is the following: `message: (something: type) => "my message"`, no `{}`, no `return` etc.
 * 		- It has to be the simple shape, or the docs generator will not be able to parse it correctly.
 * 		- If your message is fully dynamic (ex: lots of conditional logic), make `message` a proper function, like such: `message(parameters) { logic }`.
 * 			Make sure to add a `@message` tag with a static example of the error message, the docs won't be able to parse it otherwise.
 *  	- If your message is static, you can just use a string, `message: "my message"`.
 * 5. Make sure to add a JSdoc comment with the `@docs` tag so that it shows up in the docs, otherwise the error overlay will point to a 404!
 * For more information, see the README in this folder!
 */


Review comment (bug):
I regret to inform you Florian, not `better error` 😅 

How do I "review the error cause"? Do you tell me what the cause is? This isn't helpful unless you tell me what the cause is, **and also** I can actually *address* that cause with a specific action. 😅  (Neither of which I think is the case?)

As I wrote in my earlier comment, it's important to say what's going to happen here, which I believe is your project will build but using an unoptimized SVG? It's not *required* to take action, you just won't have optimization, right? Telling them they need to fix an error when fallback is built in is similarly sending them down the wrong path.

So maybe something like: 
```suggestion
	message: (path: string) => `An error occurred while optimizing SVG file "${path}" with SVGO. This SVG will be used in its original, unoptimized form.`,
	hint: 'Check that the file is not corrupt or malformed. For best performance, you may wish to reupload a manually optimized version of this SVG file using a tool like SVGOMG.',
```
???

Code after:

/**
 * @docs
 * @message Session config was provided without enabling the `experimental.session` flag
 * @deprecated This error was removed in Astro 5.7, when the Sessions feature stopped being experimental.
 * @see
 * 	- [Sessions](https://docs.astro.build/en/guides/sessions/)
 * @description
 * Thrown when session storage is configured but the `experimental.session` flag is not enabled.
 */
export const SessionConfigWithoutFlagError = {
	name: 'SessionConfigWithoutFlagError',
	title: 'Session flag not set',
	message: 'Session config was provided without enabling the `experimental.session` flag',
	hint: 'For more information, see https://docs.astro.build/en/guides/sessions/',
} satisfies ErrorData;

/**
 * @docs
 * @message An error occurred while optimizing the SVG file with SVGO.
 */
export const CannotOptimizeSvg = {
	name: 'CannotOptimizeSvg',
	title: 'Cannot optimize SVG',
	message: (path: string) => `An error occurred while optimizing SVG file "${path}" with SVGO.`,
	hint: 'Review the included SVGO error message provided for guidance.',
} satisfies ErrorData;

/*
 * Adding an error? Follow these steps:
 * 1. Determine in which category it belongs (Astro, Vite, CSS, Content Collections etc.)
 * 2. Add it at the bottom of the corresponding category above (see the @kind heading tags to see where they start), following the shape of the other errors.
 * 4. If your message is dynamic, make sure the function shape is the following: `message: (something: type) => "my message"`, no `{}`, no `return` etc.
 * 		- It has to be the simple shape, or the docs generator will not be able to parse it correctly.
 * 		- If your message is fully dynamic (ex: lots of conditional logic), make `message` a proper function, like such: `message(parameters) { logic }`.
 * 			Make sure to add a `@message` tag with a static example of the error message, the docs won't be able to parse it otherwise.
 *  	- If your message is static, you can just use a string, `message: "my message"`.
 * 5. Make sure to add a JSdoc comment with the `@docs` tag so that it shows up in the docs, otherwise the error overlay will point to a 404!
 * For more information, see the README in this folder!
 */