mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-25 13:06:22 +00:00
351 B
351 B
id | title |
---|---|
af9d9cf2-a888-4e8e-8156-4c4a664450f1 | Catching Promise Errors |
Syntax
new Promise((_, reject) => reject(new Error("Fail")))
.then(value => console.log("Handler 1"))
.catch(reason => {
console.log("Caught failure " + reason);
return "nothing";
})
.then(value => console.log("Handler 2", value));