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

jsdoc: add jsdoc for errors #3589

Closed
wants to merge 3 commits into from
Closed

Conversation

Uzlopak
Copy link
Contributor

@Uzlopak Uzlopak commented Sep 12, 2024

Maybe the style seems strange, but with this style the generated typescript typings will have no additional jsdocs

Functional changes:

HTTPParserError is now an UndiciError and has the Error Code UND_ERR_HTTP_PARSER
AbortError has now an Error Code UND_ERR_ABORT

See in the ts-playground and select d.ts in the right window to see the generated types.

this.name = 'UndiciError'
this.code = 'UND_ERR'
}
name = /** @type {string} */ 'UndiciError'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
name = /** @type {string} */ 'UndiciError'
/** @type {string} */
name = 'UndiciError'

Nit: I prefer for jsdoc comments to be above the relevant line of code. This is better for readability imo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer them above too. But compare it in the typescript playground.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You will see the difference immediatly.

@Uzlopak
Copy link
Contributor Author

Uzlopak commented Sep 16, 2024

@Ethan-Arrowood

Did you see what I mean?

@Uzlopak Uzlopak closed this Sep 30, 2024
@Uzlopak Uzlopak deleted the jsdocify-errors branch September 30, 2024 22:28
@Ethan-Arrowood
Copy link
Collaborator

sorry I never got back to this, and yeah when put above the code it becomes an actual notation for that thing. i believe that is pretty useful, especially if we start generating docs using these comments. no big deal tho!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants