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

[제안] Error code와 message 관리 #3

Open
kamothi opened this issue Mar 8, 2024 · 0 comments
Open

[제안] Error code와 message 관리 #3

kamothi opened this issue Mar 8, 2024 · 0 comments

Comments

@kamothi
Copy link
Member

kamothi commented Mar 8, 2024

모든 에러 상황에 대한 에러 코드와 메시진는 존재하지 않기에 개발자가 정의할 필요가 있어보임.

public enum Code {
    OK(0, HttpStatus.OK, "Ok"),    
    BAD_REQUEST(10000, HttpStatus.BAD_REQUEST, "Bad request"),
    VALIDATION_ERROR(10001, HttpStatus.BAD_REQUEST, "Validation error"),
    NOT_FOUND(10002, HttpStatus.NOT_FOUND, "Requested resource is not found"),
    INTERNAL_ERROR(20000, HttpStatus.INTERNAL_SERVER_ERROR, "Internal error"),
    DATA_ACCESS_ERROR(20001, HttpStatus.INTERNAL_SERVER_ERROR, "Data access error"),
    UNAUTHORIZED(40000, HttpStatus.UNAUTHORIZED, "User unauthorized");
}

위와 같은 방식으로 에러를 Enum으로 관리하여 모아둘 필요가 있어보입니다.

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

No branches or pull requests

1 participant