Promise Rejections
JS
S
JavaScriptExplains handling and debugging rejected JavaScript Promises, including error types, catching mechanisms, and best practices for asynchronous error management in ES6+.
1function resolved(result) {
2 console.log('Resolved');
3}
4
5function rejected(result) {
6 console.log(result);
7}
8
9var pms = new Promise((resolve, reject) => {
10 reject(new Error('Cannot create.'));
11});
12
13pms
14.then(resolved)
15.catch(rejected)Created on 1/17/2018