전체 글

개발블로그
· 메모장
어플리케이션 코드를 작성하다보면, 다양한 예외처리를 하게 된다.로그인 로직에서 이메일과 비밀번호를 받아, 이메일로 유저를 조회 할때 아래와 같이 작성할 수 있다.export class userLoginService { constructor( private readonly userRepository: UserRepository ) {} async login(email: string, password: string) { const user = await this.userRepository.findOneByEmail(email); // 유저가 없으면 예외처리 if(typeof user === 'undefined' || user === null) { throw new NotFou..
gigigugu
gigigugu.dev