DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Improve error handling by adding the catch block.
And many more
@pranshuchittora could you use the template that will help people triage the issue?
template?
Pls elaborate.
The following is the issue template Even is talking about :)
Describe the bug
A 馃挴 way to do this is to provide your configuration via a GitHub gist and/or to use markdown when describing which commands you used when the error occurred! Be precise and clear in your description of the bug.
What is the current behavior?
This is where you elaborate on the current behavior of the cli, how it behaves normally differing from the previous version/build you did.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Please paste the results of webpack-cli info here, and mention other relevant information
Additional context
Add any other context about the problem here like linking to an similar issue you might think is the cause.
Hello @pranshuchittora @evenstensberg ,
Could I look into this issue if it is not assigned to anyone ?
Yes!
Thank you @evenstensberg .
@pranshuchittora can you provide steps to repro this ?
I will start working on this.
@pranshuchittora Is this issue still around? If so, can I work on it ?
@manosriram go ahead!
This issue had no activity for at least half a year.
It's subject to automatic issue closing if there is no activity in the next 15 days.
bump
This still seems to be open. Last time i commented i could not understand the issue and lacked understanding about promises.
I could give this another go now. Will start working on this.
@pranshuchittora it would be helpful if you provided steps to reproduce this issue.
Thanks
Hi @pranvatsa
_The issue was raised more than a year ago, so things might have changed a lot._
Speaking of the root problem encountered earlier, was that the rejected promises were not handled for any errs/exceptions.
There are some file references in the description (outdated), in which the promise resolution was not handled properly.
As far as I remember the unhandled promise rejection will cause the process to exit in the newer versions of node.
One of the solutions is to catch every promise rejections or attaching a listener to the unhandledRejection event.
https://nodejs.org/api/process.html#process_event_unhandledrejection
I am not sure about the currently implemented error handling architecture :)
Understood :)
I wanted to verify if this has already been handled by changes made by others and close this issue. I did not see the original
then without a matching catch in one file reported originally . Just wanted to know how you got this warning earlier or steps to run the code locally to verify the issue if it still exists in other files.
Pardon, but I don't remember the exact steps to reproduce the following issue as far as I remember, I was debugging one flow and my changes caused one of the promise to fail which in turn threw the following warning.
Just a thought :)
You can probe into any promise which you think is not handled properly, and then try to explicitly reject the promise, if that's not been handled then you may see an UnhandledPromiseRejectionWarning.
Sample
function failingPromise() {
return new Promise(function (resolve, reject) {
reject();
});
}
let initPromise = failingPromise();
initPromise.then(function () {
console.log("Promise Resolved");
});
**Output**
(node:10592) UnhandledPromiseRejectionWarning: undefined
(node:10592) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:10592) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
```
I think it is fixed in latest rc, let's close, anyway if somebody faced with the issue, feel free to open a new issue