async중단

1. try-catch 블록 사용하기비동기 함수에서 오류가 발생할 가능성이 있는 코드를 try-catch로 감싸면, 오류가 나도 앱이 죽지 않고 오류를 처리할 수 있다.import { Injectable } from '@nestjs/common';@Injectable()export class ExampleService { async someAsyncFunction() { try { // 비동기 작업 수행 const result = await this.someOtherAsyncFunction(); return result; } catch (error) { // 오류 발생 시 처리 console.error('오류 발생:', error); //..
Dogfoot_JW
'async중단' 태그의 글 목록