Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] 예외 중앙처리 #11

Merged
merged 5 commits into from
Sep 24, 2024
Merged

[FEAT] 예외 중앙처리 #11

merged 5 commits into from
Sep 24, 2024

Conversation

kcsc2217
Copy link
Collaborator

📌 과제 설명

👩‍💻 요구 사항과 구현 내용

✅ 피드백 반영사항

✅ PR 포인트 & 궁금한 점

@kcsc2217 kcsc2217 linked an issue Sep 24, 2024 that may be closed by this pull request

private String code;

private String message;
Copy link
Collaborator

Choose a reason for hiding this comment

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

final 적용해도 될 것 같습니당

public ResponseEntity<ErrorResult> catchError(IllegalArgumentException e) {
log.error("[exceptionHandle] ex", e);

ErrorResult errorResult = new ErrorResult("BAD", e.getMessage());
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분의 "BAD"를 HttpStatus.BAD_REQUEST.name() 으로 바꾸시면 될 것 같습니다!


import lombok.Data;

@Data
Copy link
Collaborator

Choose a reason for hiding this comment

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

@DaTa 어노테이션은 삭제해도 될 것 같아요! getter가 필요해도 setter는 생성하지 않는게 좋다고 생각합니다!!


import lombok.Data;

@Data
Copy link
Collaborator

Choose a reason for hiding this comment

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

생성자에서 데이터를 입력받은 후 수정이나 조회가 필요 없어서 @DaTa 는 없어도 될 것 같습니당

Comment on lines 17 to 19
public ErrorResult(String code) {
this.code = code;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
public ErrorResult(String code) {
this.code = code;
}
public ErrorResult(String code) {
this.code = code;
this.message = "bad request";
}

이렇게 수정하시면 record 사용가능 할 듯 합니다!

@kcsc2217 kcsc2217 merged commit 327f8e4 into main Sep 24, 2024
1 check passed
@tnals2384 tnals2384 changed the title Feat 예외 중앙처리 [FEAT] 예외 중앙처리 Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] 예외 중앙처리
4 participants