You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Promise 객체를 만들 때 인자로 넣는 함수를 Promise executor라고 하는데요, Promise executor로 비동기 함수를 사용하는 것은 일반적으로 좋지 않은 코드 패턴이라고 여겨집니다.
그 이유는 크게 두 가지가 있는데, 먼저 Promise executor에서 핸들링되지 않은 오류가 발생하면 새로 만들어진 Promise가 reject를 반환하지 않습니다. 그리고 (거의 모든 경우) async 함수를 Promise constructor 밖으로 빼도 의도대로 잘 동작합니다.
Describe the bug
Promise 객체를 만들 때 인자로 넣는 함수를 Promise executor라고 하는데요, Promise executor로 비동기 함수를 사용하는 것은 일반적으로 좋지 않은 코드 패턴이라고 여겨집니다.
그 이유는 크게 두 가지가 있는데, 먼저 Promise executor에서 핸들링되지 않은 오류가 발생하면 새로 만들어진 Promise가 reject를 반환하지 않습니다. 그리고 (거의 모든 경우) async 함수를 Promise constructor 밖으로 빼도 의도대로 잘 동작합니다.
참조 - https://eslint.org/docs/latest/rules/no-async-promise-executor
그래서 해당 코드를 수정하려고 합니다.
chatsForRoom
함수를 async 함수로 만들면 간단하게 문제를 해결할 수 있다고 생각합니다.taxi-back/src/route/chats.socket.js
Lines 52 to 97 in 669cb50
To Reproduce
Steps to reproduce the behavior:
Screenshots
The text was updated successfully, but these errors were encountered: