Skip to content

Conversation

@catking562
Copy link

No description provided.

@catking562 catking562 changed the title 예외 처리 [Spring Core] 김태우 과제 제출합니다. Jun 3, 2024
@catking562 catking562 closed this Jun 4, 2024
@catking562 catking562 reopened this Jun 4, 2024
Copy link

@daheeParkk daheeParkk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다! 👍🏻

Comment on lines +10 to +11
Member_IsNull(400, "유저가 존재하지 않습니다."),
Board_NotNullName(400, "'name' 값이 Null이 될 수 없습니다."),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

카멜케이스와 스네이크케이스를 섞어 사용하는 것 보다 ExceptionType을 domain별로 나누는 건 어떨까요?

Comment on lines +32 to +39
public ArticleResponse create(ArticleCreateRequest request) throws HTTPApiException {
if(request.authorId()==null) throw new HTTPApiException(ExceptionType.Article_NotNullAuthorId);
if(request.boardId()==null) throw new HTTPApiException(ExceptionType.Article_NotNullBoardId);
if(request.title()==null) throw new HTTPApiException(ExceptionType.Article_NotNullTitle);
if(request.description()==null) throw new HTTPApiException(ExceptionType.Article_NotNullDescription);
if(!articleservice.isExistBoard(request.boardId())) throw new HTTPApiException(ExceptionType.Board_IsNull);
if(!articleservice.isExistUser(request.authorId())) throw new HTTPApiException(ExceptionType.Member_IsNull);
return articleservice.create(request);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Valid를 사용하면 코드가 더 깔끔해질 것 같습니다!

Copy link

@daheeParkk daheeParkk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!

Comment on lines 2 to 6
datasource:
url: jdbc:mysql://localhost:3306/bcsd # 본인의 환경에 맞게 수정한다.
username: root # 본인의 환경에 맞게 수정한다.
password: qwer1234 # 본인의 환경에 맞게 수정한다.
password: 1234 # 본인의 환경에 맞게 수정한다.
driver-class-name: com.mysql.cj.jdbc.Driver

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yml같이 중요한 정보는 안 보이게 해야 합니다!

}

@Transactional
public void delete(Long id) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

예외처리도 필요할 것 같아요

}

public boolean isExistEmail(Long notthis, String email) {
System.out.println("a");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a는 왜 출력하고 있나요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants