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

Fix: 解决了错误码覆盖的问题 #72

Merged
merged 1 commit into from
Dec 12, 2023
Merged

Fix: 解决了错误码覆盖的问题 #72

merged 1 commit into from
Dec 12, 2023

Conversation

maplestarplayl
Copy link
Contributor

@maplestarplayl maplestarplayl commented Dec 4, 2023

但是整体 的错误处理还是有些混乱,感觉可以试着规范下
比如只定义有意义(用户能看懂)的错误码,没意义的打个自定义的log就行?
比如service层尽量不定义localError,而是打log,然后controlller层调用的时候只需要返回一个抽象层次更高的错误就行 但如果service层有localError的话就用handleError处理下
不过考虑到前端人员的对接,可以在开发时多返回些service层/util层的localError,然后在上线后逐步在controller层用更高层次的错误去取代

但是整体 的错误处理还是有些混乱,感觉可以试着规范下
比如只定义有意义(用户能看懂)的错误码,没意义的打个自定义的log就行?
比如service层尽量不定义localError,而是打log,然后controlller层调用的时候只需要返回一个抽象层次更高的错误就行
但如果service层有localError的话就用handleError处理下
@maplestarplayl maplestarplayl merged commit dc51a61 into main Dec 12, 2023
1 check passed
@aimixsaka aimixsaka self-requested a review December 12, 2023 09:35
@aimixsaka aimixsaka self-assigned this Dec 12, 2023
aimixsaka pushed a commit that referenced this pull request Jul 16, 2024
但是整体 的错误处理还是有些混乱,感觉可以试着规范下
比如只定义有意义(用户能看懂)的错误码,没意义的打个自定义的log就行?
比如service层尽量不定义localError,而是打log,然后controlller层调用的时候只需要返回一个抽象层次更高的错误就行
但如果service层有localError的话就用handleError处理下
aimixsaka pushed a commit that referenced this pull request Jul 16, 2024
但是整体 的错误处理还是有些混乱,感觉可以试着规范下
比如只定义有意义(用户能看懂)的错误码,没意义的打个自定义的log就行?
比如service层尽量不定义localError,而是打log,然后controlller层调用的时候只需要返回一个抽象层次更高的错误就行
但如果service层有localError的话就用handleError处理下
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