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

Code before:
	message: (globStr: string) => `\`Astro.glob(${globStr})\` did not return any matching files.`,
	hint: 'Check the pattern for typos.',
} satisfies ErrorData;
/**
 * @docs
 * @see
 * - [Astro.redirect](https://docs.astro.build/en/reference/api-reference/#redirect)
 * @description
 * A redirect must be given a location with the `Location` header.
 */
export const RedirectWithNoLocation = {
	name: 'RedirectWithNoLocation',
	title: 'A redirect must be given a location with the `Location` header.',
} satisfies ErrorData;

/**
 * @docs
 * @see
 * - [Astro.redirect](https://docs.astro.build/en/reference/api-reference/#redirect)
 * @description
 * An external redirect must start with http or https, and must be a valid URL.
 */
export const UnsupportedExternalRedirect = {
	name: 'UnsupportedExternalRedirect',
	title: 'Unsupported or malformed URL.',
	message: (from: string, to: string) => `The external redirect from "${from}" to "${to}" is invalid.`,
	hint: 'An external redirect must start with http or https, and must be a valid URL.',
} satisfies ErrorData;

/**
 * @docs
 * @see
 * - [Dynamic routes](https://docs.astro.build/en/guides/routing/#dynamic-routes)
 * @description
 * A dynamic route param is invalid. This is often caused by an `undefined` parameter or a missing [rest parameter](https://docs.astro.build/en/guides/routing/#rest-parameters).
 */
export const InvalidDynamicRoute = {
	name: 'InvalidDynamicRoute',
	title: 'Invalid dynamic route.',
	message: (route: string, invalidParam: string, received: string) =>
		`The ${invalidParam} param for route ${route} is invalid. Received **${received}**.`,
} satisfies ErrorData;
/**
 * @docs
 * @see
 * - [Default Image Service](https://docs.astro.build/en/guides/images/#default-image-service)
 * - [Image Services API](https://docs.astro.build/en/reference/image-service-reference/)
 * @description
 * Sharp is the default image service used for `astro:assets`. When using a [strict package manager](https://pnpm.io/pnpm-vs-npm#npms-flat-tree) like pnpm, Sharp must be installed manually into your project in order to use image processing.
 *
 * If you are not using `astro:assets` for image processing, and do not wish to install Sharp, you can configure the following passthrough image service that does no processing:

Review comment (suggestion):
Here are some ideas for you! See if you like anything here!

My motivation is: people don't like being told their stuff is "invalid" if it's just malformed for our system 😄 

```suggestion
	message: (from: string, to: string) => `The external redirect from "${from}" to "${to}" cannot be processed because the destination URL is unsupported.`,
```
OR, I kind of like focusing on the place you're redirecting to (since that is going to be the problem with this error message, not the original URL), so we don't HAVE to think of it as FROM (not a problem) going to TO (where the problem actually is) when we want to draw attention to the later thing...

```suggestion
	message: (from: string, to: string) => `The destination URL in the external redirect from "${from}" to "${to}" is unsupported.`,
```

Since the hint describes *why*, maybe this can just say, "we can't do it".

I'll leave it to you to choose, but just telling people their stuff is "invalid" when we could imply "not formatted properly" can feel a little harsh. 😄 

Code after:
	message: (globStr: string) => `\`Astro.glob(${globStr})\` did not return any matching files.`,
	hint: 'Check the pattern for typos.',
} satisfies ErrorData;
/**
 * @docs
 * @see
 * - [Astro.redirect](https://docs.astro.build/en/reference/api-reference/#redirect)
 * @description
 * A redirect must be given a location with the `Location` header.
 */
export const RedirectWithNoLocation = {
	name: 'RedirectWithNoLocation',
	title: 'A redirect must be given a location with the `Location` header.',
} satisfies ErrorData;

/**
 * @docs
 * @see
 * - [Astro.redirect](https://docs.astro.build/en/reference/api-reference/#redirect)
 * @description
 * An external redirect must start with http or https, and must be a valid URL.
 */
export const UnsupportedExternalRedirect = {
	name: 'UnsupportedExternalRedirect',
	title: 'Unsupported or malformed URL.',
	message: (from: string, to: string) => `The destination URL in the external redirect from "${from}" to "${to}" is unsupported.`,
	hint: 'An external redirect must start with http or https, and must be a valid URL.',
} satisfies ErrorData;

/**
 * @docs
 * @see
 * - [Dynamic routes](https://docs.astro.build/en/guides/routing/#dynamic-routes)
 * @description
 * A dynamic route param is invalid. This is often caused by an `undefined` parameter or a missing [rest parameter](https://docs.astro.build/en/guides/routing/#rest-parameters).
 */
export const InvalidDynamicRoute = {
	name: 'InvalidDynamicRoute',
	title: 'Invalid dynamic route.',
	message: (route: string, invalidParam: string, received: string) =>
		`The ${invalidParam} param for route ${route} is invalid. Received **${received}**.`,
} satisfies ErrorData;
/**
 * @docs
 * @see
 * - [Default Image Service](https://docs.astro.build/en/guides/images/#default-image-service)
 * - [Image Services API](https://docs.astro.build/en/reference/image-service-reference/)
 * @description
 * Sharp is the default image service used for `astro:assets`. When using a [strict package manager](https://pnpm.io/pnpm-vs-npm#npms-flat-tree) like pnpm, Sharp must be installed manually into your project in order to use image processing.
 *
 * If you are not using `astro:assets` for image processing, and do not wish to install Sharp, you can configure the following passthrough image service that does no processing: