Last active
November 25, 2017 12:35
-
-
Save wizardnet972/e3f4ea041a818cd9fcab28dcfbf526e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| router.all('/incaseoferror', async(req, res, next) => { | |
| const promise = await new Promise(function (resolve, reject) { | |
| setTimeout(function () { | |
| reject(new Error('this is a test err')); | |
| }, 3000); | |
| }); | |
| // throw new Error('test error'); | |
| }); | |
| function clientErrorHandler(err, req, res, next) { | |
| console.log('in clientErrorHandler', err); | |
| //but not catch the promise error! | |
| }); | |
| process.on('uncaughtException', function (error) { | |
| // the error is catch here.. | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment