Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging refresh #8833

Closed
wants to merge 8 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions packages/astro/src/core/errors/errors-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ export const MissingMediaQueryDirective = {
* @docs
* @message Unable to render `COMPONENT_NAME`. There are `RENDERER_COUNT` renderer(s) configured in your `astro.config.mjs` file, but none were able to server-side render `COMPONENT_NAME`.
* @see
* - [Configuring a UI framework integration](https://docs.astro.build/en/core-concepts/framework-components/)
* - [List of all official UI framework integrations](https://docs.astro.build/en/guides/integrations-guide/#official-integrations)
* - [Frameworks components](https://docs.astro.build/en/core-concepts/framework-components/)
* - [UI Frameworks](https://docs.astro.build/en/guides/integrations-guide/#official-integrations)
* @description
* None of the installed integrations were able to render the component you imported. Make sure to install the appropriate integration for the type of component you are trying to include in your page.
*
Expand Down Expand Up @@ -369,10 +369,10 @@ export const GetStaticPathsInvalidRouteParam = {
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
* - [Server-side Rendering](https://docs.astro.build/en/guides/server-side-rendering/)
* @description
* In [Static Mode](https://docs.astro.build/en/core-concepts/routing/#static-ssg-mode), all routes must be determined at build time.
* In [Static Mode](https://docs.astro.build/en/core-concepts/routing/#static-ssg-mode), all routes must be determined at build time.
* Dynamic routes must `export` a `getStaticPaths()` function to tell Astro which paths must be generated at build time. This can happen
* when you are building a static site, or when you are prerendering a certain route with `export const prerender = true`.
* To resolve, either add a `getStaticPaths()` function to your page or set \`output: "server"\` or \`output: "hybrid"\` in your Astro
* To resolve, either add a `getStaticPaths()` function to your page or set \`output: "server"\` or \`output: "hybrid"\` in your Astro
* configuration file to switch the entire project over to a non-static, server build.
*/
export const GetStaticPathsRequired = {
Expand Down Expand Up @@ -474,18 +474,20 @@ export const PageNumberParamNotFound = {
* - [Images](https://docs.astro.build/en/guides/images/)
* - [Image component](https://docs.astro.build/en/guides/images/#image--astroassets)
* - [Image component#alt](https://docs.astro.build/en/guides/images/#alt-required)
* - [<img> alt="" attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#alt)
* - [<img> alt attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#alt)
* @description
* The `alt` property allows you to provide descriptive alt text to users of screen readers and other assistive technologies. In order to ensure your images are accessible, the `Image` component requires that an `alt` be specified.
*
* If the image is merely decorative (i.e. doesn’t contribute to the understanding of the page), set `alt=""` so that screen readers know to ignore the image.
*/
export const ImageMissingAlt = {
name: 'ImageMissingAlt',
title: 'Missing alt property.',
message: 'The alt property is required.',
hint: 'Use alt="" if image is not a key part of page content.',
title: 'Image missing required "alt" property.',
message:
'Image missing "alt" property. "alt" text is required to describe important images on the page.',
hint: 'Use an empty string ("") for decorative images.',
} satisfies ErrorData;

/**
* @docs
* @see
Expand All @@ -498,8 +500,7 @@ export const ImageMissingAlt = {
export const InvalidImageService = {
name: 'InvalidImageService',
title: 'Error while loading image service.',
message:
'There was an error loading the configured image service.',
message: 'There was an error loading the configured image service.',
} satisfies ErrorData;
/**
* @docs
Expand Down Expand Up @@ -603,7 +604,7 @@ export const ExpectedImage = {
title: 'Expected src to be an image.',
message: (src: string, typeofOptions: string, fullOptions: string) =>
`Expected \`src\` property for \`getImage\` or \`<Image />\` to be either an ESM imported image or a string with the path of a remote image. Received \`${src}\` (type: \`${typeofOptions}\`).\n\nFull serialized options received: \`${fullOptions}\`.`,
hint: "Is your `src` path correct? If passing an async function, make sure to call and await it.",
hint: 'Is your `src` path correct? If passing an async function, make sure to call and await it.',
} satisfies ErrorData;
/**
* @docs
Expand Down Expand Up @@ -656,7 +657,7 @@ export const ImageNotFound = {
name: 'ImageNotFound',
title: 'Image not found.',
message: (imagePath: string) => `Could not find requested image \`${imagePath}\`.`,
hint: 'Does the file exist?'
hint: 'Does the file exist?',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will push back a bit on this one. It in fact has usually been a typo for me when I hit this error! "Does it exist?" is pretty condescending, and not nearly as helpful as the prompt to check for a typo!

Same for the same proposed change below.

} satisfies ErrorData;

/**
Expand Down Expand Up @@ -694,7 +695,7 @@ export const MarkdownImageNotFound = {
`Could not find requested image \`${imagePath}\`${
fullImagePath ? ` at \`${fullImagePath}\`.` : '.'
}`,
hint: 'Does the file exist?'
hint: 'Does the file exist?',
} satisfies ErrorData;

/**
Expand Down Expand Up @@ -801,9 +802,9 @@ export const LocalsNotAnObject = {
*/
export const LocalImageUsedWrongly = {
name: 'LocalImageUsedWrongly',
title: 'Local images must be imported.',
title: 'Local image "src" value not supported.',
message: (imageFilePath: string) =>
`\`Image\`'s and \`getImage\`'s \`src\` parameter must be an imported image or a URL, it cannot be a string filepath. Received \`${imageFilePath}\`.`,
`Image "src" value not supported. Local images must be imported with the ESM "import" keyword or the "image()" schema helper in a content collection. Received "${imageFilePath}".`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I purposely use backticks because they show with special highlighting in the browser (and was honestly hoping to add special highlighting in the CLI too one day)

} satisfies ErrorData;

/**
Expand Down Expand Up @@ -1029,7 +1030,7 @@ export const MdxIntegrationMissingError = {
/**
* @docs
* @see
* - [Configuration Reference](https://docs.astro.build/en/reference/configuration-reference/)
* - [Configuration reference](https://docs.astro.build/en/reference/configuration-reference/)
* @description
* Astro encountered an unknown error loading your Astro configuration file.
* This is often caused by a syntax error in your config and the message should offer more information.
Expand Down Expand Up @@ -1063,7 +1064,8 @@ export const ConfigNotFound = {
export const ConfigLegacyKey = {
name: 'ConfigLegacyKey',
title: 'Legacy configuration detected.',
message: (legacyConfigKey: string) => `Legacy configuration detected: \`${legacyConfigKey}\`. update your configuration to the new format.`,
message: (legacyConfigKey: string) =>
`Legacy configuration detected: \`${legacyConfigKey}\`. update your configuration to the new format.`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`Legacy configuration detected: \`${legacyConfigKey}\`. update your configuration to the new format.`,
`Legacy configuration detected: \`${legacyConfigKey}\`. Update your configuration to the current supported format.`,

Just while I'm here... I don't like referring to current, existing things as "new" because that doesn't age well. At some point, this isn't "new", it's just the way it is. This is more future-proof.

} satisfies ErrorData;
/**
* @docs
Expand Down