티스토리 뷰

Javascript

Promise 내의 async

딩신 2021. 1. 7. 19:38

. Promise callback 함수를 async로 쓰면 Promise 가 에러를 캐치하지 못할 수 있다

프로미스 내에서 어씽크, await 를 쓰다 보면 내부에서 또 새로운 프로미스 객체를 생성하기 때문으로 보인다.

관련 eslint

eslint.org/docs/rules/no-async-promise-executor

 

no-async-promise-executor - Rules

 

eslint.org

 

pouchdb.com/2015/05/18/we-have-a-problem-with-promises.html

 

We have a problem with promises

Clarification: for these examples, I’m assuming that both doSomething() and doSomethingElse() return promises, and that those promises represent something done outside of the JavaScript event loop (e.g. IndexedDB, network, setTimeout), which is why they

pouchdb.com

 

댓글