-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
docs(API) Add error report introduction of loaders (#2231) #2298
Conversation
I don't know whether I should fix this. but the CI test can't pass if I don't. |
@mc-zone Yes, you should, It was passing before. |
Seems we have to fetch some content every time. Can these be cached or some other workaround? @montogeek |
Anyone could review this? is this enough to be merged? 🚶 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice additions!
src/content/api/loaders.md
Outdated
|
||
### Using `throw` (or other uncaught exception) | ||
|
||
Throw out an uncaught error while loader are running will cause current module compiling failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...while a loader is running
is correct.
Correct word is fail
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or: Throwing an error while loader is running will cause current module compilation failure.
src/content/api/loaders.md
Outdated
|
||
``` | ||
|
||
the module that ouccur this error will be packed into bundle (as an error module) like the following: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean on this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module on which loader had thrown this error will get bundled like this:
src/content/api/loaders.md
Outdated
|
||
``` | ||
|
||
And you can see these informations below, not only error message, but also details about which loader and module are involved: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see below
would sound better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure, shorter and clearer
src/content/api/loaders.md
Outdated
|
||
## Error Reporting | ||
|
||
There are some ways to throw out errors from inside a loader: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this sounds abstract, please be more specific. e.g. Here are the ways to throw an error from inside a loader:...
src/content/api/loaders.md
Outdated
|
||
### Using `this.emitError` | ||
|
||
It just report errors but not interrupt module compiling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[this.emitError](/api/loaders/#this-emiterror) will report the errors without interrupting module's compilation.
or any other way you can rephrase this to sound closer to software documentation page
src/content/api/loaders.md
Outdated
|
||
It just report errors but not interrupt module compiling. | ||
|
||
see [this.emitError](/api/loaders/#this-emiterror). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
src/content/api/loaders.md
Outdated
- the loader path: `(from ./src/loader.js)` | ||
- the caller path: `@ ./src/index.js 1:0-25` | ||
|
||
W> The loader path about error in the above are added after webpack 4.12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loader path in the error is displayed since webpack 4.12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would really love to see texts shaped accordingly with the rest of documentation. Right now they are not of a documentation level
@mc-zone Friendly ping. |
Updated. @montogeek @EugeneHlushko Sorry about this... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change compiling to compilation to be consistent
Fix typo. Use js instead of js-with-link.
@montogeek @EugeneHlushko Hi, is there anything else that I should do for this PR? Please tell me if anything wrong. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for updating the PR! It looks really good now, a couple of small changes requested and one question re eslint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@montogeek please have another look |
Thanks! |
These additions resolve #2231 .