[RFC] Optimize error printing and suggestions #4325
chenjiahan
started this conversation in
RFC Discussions
Replies: 1 comment 4 replies
-
Is it possible that for some errors we can automatically modify the configuration to fix them? For example for an error like this: We can modify the project's // Some notes explaining the `patchConfig`
export const patchConfig = {
source: {
include: ['foo'],
},
};
export default defineConfig({
source: {
include: [/*...*/],
}
}); The |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
1. Summary
We want to optimize error printing and add more suggestions to the error logs in Modern.js. This will make it easier for developers to address and solve problems.
2. Basic example
A good error log has four parts:
A good example from Vitest:
3. Motivation
4. Detailed design
Error messages and stack
There are already many error messages in the Modern.js framework, some of which are thrown by low-level tools, such as webpack, Rspack and babel.
We want to:
And we can follow some principles to improve the quality of the message:
Suggestion and example
Currently, Modern.js does not provide enough suggestions and examples in the error logs, and we should add them to help users quickly solve some common problems.
For example, we have already written many FAQs for Modern.js Builder, and we can integrate those FAQs into the error logs, so that users do not have to open the document and search for the solutions.
5. Some examples
Here are some examples of changes that have been made:
Add suggestion and example (#4288)
Before
After
Use the standard logger module (#3262)
Before
After
Display the complete error stack (#4135)
Before
After
Provide i18n error messages (#4151)
Before (Only Chinese)
After
6. Refs
Beta Was this translation helpful? Give feedback.
All reactions