Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

promise catch javascript

// errors that occur in asynchronous code inside promises cannot be caught with regular try/catch
// you need to pass the error handler into `.catch()`

fetchUserData(userId).then(console.log).catch(handleError);
Source by learn.coderslang.com #
 
PREVIOUS NEXT
Tagged: #promise #catch #javascript
ADD COMMENT
Topic
Name
7+4 =