namjh654 / mnu_busproject_app

project :
0 stars 1 forks source link

UnhandledPromiseRejectionWarning: Unhandled promise rejection. 서버 다운 문제 #24

Open namjh654 opened 3 years ago

namjh654 commented 3 years ago

UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

namjh654 commented 3 years ago

https://ko.javascript.info/promise-error-handling

namjh654 commented 3 years ago

https://dev-dain.tistory.com/77

한 줄 요약 : async-await에서 try-catch를 쓰지 않아서 warning이 뜨는 것이다. await를 쓰는 부분은 죄다 try 블록으로 감싸주고 catch로 에러를 잡아 처리하자.