I have the following code. And it works as expected without throwing an unhandled rejection error.
p = new Promise (fulfill, reject) -> reject new Error 'some error' p.catch (error) -> console.log error
Now the second code example is causing a raw rejection error. Can someone explain to me why this happens when I am clearly dealing with the error.
p = new Promise (fulfill, reject) -> reject new Error 'some error' p.then -> console.log 'ok' p.catch (error) -> console.log error
Btw. I am testing chrome and bluebird v3.4.7.
Per Bluebird , , , , , . , , . , " ". , ?
, ES6, -: Firefox , GC, Chrome ( ) .
Blue Bird Bluebird promises, .
p, , , - .
p
@DJ , . then , , p . , .then, , .
then
.then
Promises, Promise.
catch() then(), , .
catch()
then()
, 1: catch() promises, .
2: , , 2- , . catch(), , then(), , 1-
. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch , catch
Source: https://habr.com/ru/post/1667591/More articles:WSO25.3 User User Manager - wso2isAngular2 CLI Build Prod Build Error: Call Function "NoOpAnimationDriver", Function Calls Not Supported - angularHow to print the calculation execution time executed in tensorflow code? - pythonrequire.js required module with index.js - javascriptTime series of the subset so that the selected series differ by a certain minimum time - rscope exponential backoff to restart spider scan after each exception - pythonSearchHow to inherit an embedded service from a superclass to a subclass component in Angular 2 - inheritanceWhat is the advantage of defining an βorβ operation in clojure as a macro rather than just as a function? - clojuredo i need to add submodule folder in .gitignore? - gitAll Articles