for await (const value of createAsyncIterable()) {
console.log(value);
}
}
9.4.3
비동기 에러 처리
비동기 에러 처리
async
Error
Handling
패턴은
try
-
catch
블록을 사용하여 비동기 함수 실행 도중
발생할 수 있는 에러를 처리합니다.
async function main() {
try {
const data = await makeRequest("http://example.com/");
console.log(data);
} catch (error) {
console.error(error);
}
}
9.4.4
비동기 병렬
비동기 병렬
async
Parallelism
패턴은
Promise
.
all
메서드를 사용하여 여러 비동기 작업을 동시
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.