pr 수정하기
에러핸들링
merge 성공적으로 하기
테스트코드 개념 알기
나중에 CRUD 다 머지하고 난 다음에 중간 과정 제대로 정리할거임!
원문 출처
The simplest way we handle errors is to respond with an appropriate status code.
Here are some common response codes:
400 Bad Request – client sent an invalid request, such as lacking required request body or parameter
401 Unauthorized – client failed to authenticate with the server
403 Forbidden – client authenticated but does not have permission to access the requested resource
404 Not Found – the requested resource does not exist
412 Precondition Failed – one or more conditions in the request header fields evaluated to false
500 Internal Server Error – a generic error occurred on the server
503 Service Unavailable – the requested service is not available
DELETE blog/:id에서 해당하는 id값이 없는 경우 에러를 반환하고 싶다
일단 id에 해당하는 board를 찾은 다음 null 인 경우와 아닌 경우를 if문으로 처리한다.
깃허브 코드
js try catch null nestjs error 로 검색해보니까
throw new NotFoundException 로 핸들링하면 되는 듯

디버깅 찍어보니 값이 이렇게 떠서 조건문을 if(droppedBoard === null) 이라고 적었는데
falsy 체크로 조건문 바꿔줌 (매번 undefined인지 null인지 모르니까.)
async deleteBoard(id: string): Promise<void> {
try {
const droppedBoard = await this.boardRepository.findOne({
where: {
id,
},
});
if (!droppedBoard) {
this.boardRepository.delete(id);
}
throw new NotFoundException('Corresponding ID is not found');
} catch (e) {
throw e;
}
}
try .. catch 개념 다시 보고옴
아는게 업따.
@Delete('/:id')
async deleteBoard(@Param('id') id: string) {
await this.boardService.deleteBoard(id);
}
뻘짓:
이때 프로미스 안까줘서 에러가 펜딩되어있었는데 왜 404에러가 안뜨지.. 이러구 있었다.
당연한건데 컨트롤러에서 어떻게 비즈니스 로직을 호출하는지에 대해서 고려를 안했다. 부끄럽군..

처음 Update 구현할 때 나머지는 비슷비슷해서 바로 함
git revert 했는데 리버트한것도 커밋에 내역 떴음 이제 제대로 된건지는 아직 모름
안됐따.. 아직도 잘 모르겠다.
깃 꼬였다 ㅎ
콩글리시 써서
I didn't stash git and check out another branch 검색하니까
https://stackoverflow.com/questions/22053757/checkout-another-branch-when-there-are-uncommitted-changes-on-the-current-branch
보고 해결할 예정..
... 이 아니라
`git status 쳐서 보니까!! 브랜치 바꾸고 나서 깃 추적된게 없었다!!

그냥 다시 원래 브랜치 돌아갔다.
이거 걍 커밋 revert 하면서 파일자체가 오류나있었는듯..
https://rainpour.tistory.com/61

브랜치 전략은 Git flow, GitLab flow, Github flow 총 3개로 나뉘어지는데 그 중 github flow에 대해서 알아보려고 한다
보고 정리함

https://hellowoori.tistory.com/56
대충 브랜치 관리 잘하고 커밋 열심히하고 pr 잘 날리고 머지하면 됨~ 으로 이해함!