Skip to content

docs: Update errorCodes ESM import and usage#5388

Closed
melroy89 wants to merge 2 commits intofastify:mainfrom
melroy89:fix_fastify_error_codes_esm
Closed

docs: Update errorCodes ESM import and usage#5388
melroy89 wants to merge 2 commits intofastify:mainfrom
melroy89:fix_fastify_error_codes_esm

Conversation

@melroy89
Copy link
Copy Markdown
Contributor

@melroy89 melroy89 commented Apr 5, 2024

Checklist

@melroy89 melroy89 changed the title docs: Update errorCodes import and usage docs: Update errorCodes ESM import and usage Apr 5, 2024
// ESM
import { errorCodes } from 'fastify'
import fastify from 'fastify'
fastify.errorCodes
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Currently, it is not possible to do so.

Copy link
Copy Markdown
Contributor

@Uzlopak Uzlopak left a comment

Choose a reason for hiding this comment

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

This PR is not adding any value.

Copy link
Copy Markdown
Member

@climba03003 climba03003 left a comment

Choose a reason for hiding this comment

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

Actually, you should move the fastify.errorCodes = errorCodes to module.exports.errorCodes = errorCodes in fastify.js.
Note that it must below module.exports = fastify.

@melroy89
Copy link
Copy Markdown
Contributor Author

melroy89 commented Apr 6, 2024

This PR is not adding any value.

Well actually.. It's showing how ESM errorCodes are currently implemented in fastify. Hence the documentation request.

But we can also improve the code. Either way, the documentation is currently not reflecting how it now works.

It's adding value if you want your documention saying how fastify is working.

@melroy89 melroy89 mentioned this pull request Apr 6, 2024
8 tasks
@melroy89
Copy link
Copy Markdown
Contributor Author

melroy89 commented Apr 6, 2024

Actually, you should move the fastify.errorCodes = errorCodes to module.exports.errorCodes = errorCodes in fastify.js. Note that it must below module.exports = fastify.

Like this: #5390 ?

@melroy89 melroy89 closed this Apr 6, 2024
@melroy89 melroy89 deleted the fix_fastify_error_codes_esm branch April 6, 2024 12:29
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2025

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants