Create unhandledRejection.js
This commit is contained in:
1 parent
6f05545be6
commit
4ed2aff1b7
1 file changed
+10
@@ -0,0 +1,10 @@
|
||||
process.on('unhandledRejection', error => {
|
||||
// Will print "unhandledRejection err is not defined"
|
||||
console.log('unhandledRejection', error.message);
|
||||
});
|
||||
|
||||
new Promise((_, reject) => reject(new Error('woops'))).
|
||||
catch(error => {
|
||||
// Will not execute
|
||||
console.log('caught', err.message);
|
||||
});
|
||||
Reference in new issue
Block a user