Document thrown errors in JSDoc #856
valerii15298
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When hovering over
jwtVerifyfunction there is description of its parameters. While the return value can be discoverable through typescript, the thrown errors are only discoverable when testing it or looking at the docs.Documenting thrown errors would help user to better handle errors.
The ecosystem is shifting to handle errors as values. This would be a breaking change and I do not dare to suggest it to such popular and important library as this one. But at least documenting the errors would help users significantly to discover them through JSDoc.
Adding the general
JOSEErrorwould be the simplest way to add it for most functions: https://github.com/panva/jose/blob/main/docs/util/errors/classes/JOSEError.mdBeta Was this translation helpful? Give feedback.
All reactions