Skip to content

Commit ce7ba42

Browse files
authored
Merge pull request #174 from osamhack2021/feature/backend/#173
Fix: User 조회 시 조회결과가 null이면 NotFoundError 호출 #173
2 parents 27475a6 + 775e0a0 commit ce7ba42

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

backend/services/userService.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ module.exports = {
1717
const result = await User
1818
.find(params, projection)
1919
.catch(err => {
20-
throw new RuntimeError(params + '를 불러올 수 없습니다.');
20+
throw new RuntimeError('조회를 진행할 수 없습니다.');
2121
});
2222

23-
if(result === null) throw new NotFoundError('Not Found: 검색 결과가 없습니다.');
24-
2523
return result;
2624
},
2725

@@ -30,11 +28,9 @@ module.exports = {
3028
const result = await User
3129
.findOne(params, projection)
3230
.catch(err => {
33-
throw new RuntimeError(params + '를 불러올 수 없습니다.');
31+
throw new NotFoundError('Not Found: '+ params._id + '에 대한 검색 결과가 없습니다.');
3432
});
35-
36-
if(result === null) throw new NotFoundError('Not Found: 검색 결과가 없습니다.');
37-
33+
3834
return result;
3935
},
4036

0 commit comments

Comments
 (0)