Created
March 4, 2018 15:28
-
-
Save AlexandroPerez/8cf1f5e35ef50d5a8f098bebd1caa31b to your computer and use it in GitHub Desktop.
This file contains 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
myPromise.then(function() { | |
// Some error may happen | |
throw('An exception that would be caught'); | |
}).catch(function() { | |
console.log('error'); | |
}); | |
// Is the same as this, the errHandle tries to catch any unhandled error | |
// from previous result. | |
myPromise.then(func, null).then(null, errHandle); | |
myPromise.then(function() { | |
// Some error may happen | |
throw('An unhandled exception.'); | |
}, function() { | |
// This won't log the error if it happens in the | |
// some error may happen block. | |
console.log('error'); | |
}); | |
// Is the same as this, the errHandle will handle errors from previous result, | |
// but it won't handle errs in func. | |
myPromise.then(func, errHandle) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment