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(login): 错误处理 #5

Merged
merged 2 commits into from
Mar 29, 2022
Merged

feat(login): 错误处理 #5

merged 2 commits into from
Mar 29, 2022

Conversation

guowei-gong
Copy link
Collaborator

错误处理底层使用标准库的 errors.Wrapf,因此我们业务中返回错误都适用于 errors,但是推荐使用我们 perr 定义错误。因为在项目迭代,使用 rpc 后,rpc 的返回的错误我们可以自定义重写,返回给前端错误信息。默认返回错误:服务器开小差了。
目前在 login 模块已经使用了错误码封装。错误处理后,自动日志上报未完成。错误已经可以打印到 console。

错误处理底层使用标准库的 errors.Wrapf,因此我们业务中返回错误都适用于 errors,但是推荐使用我们 perr 定义错误。因为在项目迭代,使用 rpc 后,rpc 的返回的错误我们可以自定义重写,返回给前端错误信息。默认返回错误:服务器开小差了。
目前在 login 模块已经使用了错误码封装。错误处理后,自动日志上报未完成。错误已经可以打印到 console
@guowei-gong
Copy link
Collaborator Author

日志收集与错误处理相辅相成,目前在控制台打印已完成,把错误写入到日志都已经完成。但是打印到控制台的格式是丑陋的,还需要排查打印格式的问题 :-)

@guowei-gong guowei-gong merged commit 919b92b into minibear2333:main Mar 29, 2022
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.

1 participant