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-5] 모든 Error Function Customize 지원하기 #10

Merged
merged 3 commits into from
Jul 23, 2022
Merged

Conversation

akshxl09
Copy link
Collaborator

모든 error에 대해서 customizing이 가능하도록 변경

JWT_CONFIG에 추가하는 방식으로 error customizing 지원

모든 error에 대해서 customizing 가능하도록 수정
@akshxl09 akshxl09 added the enhancement New feature or request label Jul 23, 2022
@akshxl09 akshxl09 requested a review from iml1111 July 23, 2022 13:45
@akshxl09 akshxl09 self-assigned this Jul 23, 2022
@akshxl09 akshxl09 linked an issue Jul 23, 2022 that may be closed by this pull request
@akshxl09 akshxl09 changed the base branch from main to dev-1.0 July 23, 2022 13:46
@staticmethod
def customize_jwt_not_found(config: dict):
jwt_not_found = config.get('JWT_NOT_FOUND_MSG', 'JWT token not found')
return {'msg': jwt_not_found}
Copy link
Owner

Choose a reason for hiding this comment

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

메시지 하나(string)가 아닌 dict를 통째로 customize 가능하게 해주셈.
또한 해당 인자를 입력받았을 때 해당인자가 json serialize가 가능한지도 validate해주셈.
물론 밑에 모든 customize 메소드에 동일하게 적용해주셈.

Copy link
Owner

Choose a reason for hiding this comment

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

추가적으로, 모든 customize 메소드가 로직 자체는 굉장히 유사한 걸 알 수 있음.
아예 인자를 빼서 for문을 돌리면서 함수를 하나로 만들어 버리는 것도 괜찮을 것 같음.

string이 아닌 dict를 customizing 하도록 변경
json serializable한지 검증
전체 error customizing  메소드 통합
print -> assertEqual로 변경
@iml1111 iml1111 merged commit 2518961 into dev-1.0 Jul 23, 2022
@iml1111 iml1111 deleted the feat-5 branch July 23, 2022 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

모든 Error Function Customize 지원하기
2 participants