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

Add JSDOC @message param to broken error pages #6076

Merged
merged 2 commits into from
Feb 1, 2023

Conversation

yanthomasdev
Copy link
Member

Changes

Added JSDOC @message param to InvalidContentEntrySlugError & ContentSchemaContainsSlugError errors to fix their generated docs pages.

Before After
image image
image image

The function we use in docs to extract the error messages from this file expects functions to follow this style:

message: (params: string) => `Message ${params}`,

These and a few other errors follow this, instead:

message: (configFile: string) => {
        return message: (params: string) => `Message ${params}`;
},

Not sure if this function style makes a difference in the core side of things, if possible I'd advocate going with the former function style so we avoid possible errors (and if it can't be avoided, to use @message for these error messages).

When available, the docs doc gen script uses the JSDOC @message param instead, so I added it to the problematic functions as a fix. Also because they have dynamic values we can't bring to docs (like the current collection or entryId), in which case, it's better to use JSDoc anyway to overwrite these values with COLLECTION_NAME and ENTRY_ID, for extra clarity.

Testing

Only JSDOC comments, shouldn't affect code behavior.

Docs

It's all docs baby 😎

cc @withastro/maintainers-docs for feedback!

@yanthomasdev yanthomasdev requested a review from a team as a code owner January 31, 2023 20:33
@changeset-bot
Copy link

changeset-bot bot commented Jan 31, 2023

⚠️ No Changeset found

Latest commit: 1e0e146

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jan 31, 2023
Copy link
Contributor

@hippotastic hippotastic left a comment

Choose a reason for hiding this comment

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

LGTM and fixes the issue in docs!

Copy link
Contributor

@bholmesdev bholmesdev left a comment

Choose a reason for hiding this comment

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

Gotcha, will doctor up our errors with @message in the future!

@yanthomasdev yanthomasdev merged commit e193dfa into main Feb 1, 2023
@yanthomasdev yanthomasdev deleted the yan/fix-error-docgen branch February 1, 2023 12:29
matthewp pushed a commit that referenced this pull request Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants