berry
berry copied to clipboard
[Feature] Request: document how to implement YNX plugin error codes
- [x] I'd be willing to implement this feature (contributing guide)
- [ ] This feature is important to have in this repository; a contrib plugin wouldn't do
Describe the user story
In https://yarnpkg.com/advanced/error-codes, there is a top-of-page infobox:
Are you a plugin author and want to declare your own error codes that don't match the semantic of the ones provided here? Please relinquish one character and use the YNX prefix (ex YNX001) instead of YN0!
However, given that reportWarning
only accepts a MessageName
as the first parameter (which is defined as a fixed type), and stringifyMessageName
automatically prepends only YN
, it's not clear how plugin authors should do this. An example of how this is intended would be great, and if that needs some changes to provide entry points, adding those.
Describe the solution you'd like
- If there's a specific intended implementation route for YNX errors, document it with a short example.
- If there is no current way for plugin authors to
reportWarning
or similar withYNX
code, then either make it possible or clarify the infobox to reflect what's possible today.