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

[Bug]: 每一个err不是应该只被处理一次吗? #1506

Open
bellingham07 opened this issue Aug 9, 2023 · 7 comments
Open

[Bug]: 每一个err不是应该只被处理一次吗? #1506

bellingham07 opened this issue Aug 9, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@bellingham07
Copy link

gin-vue-admin 版本

2.4.5

Node 版本

v1.16

Golang 版本

go1.20

是否依旧存在

可以

bug描述

if err != nil { global.GVA_LOG.Error("接收文件失败!", zap.Error(err)) response.FailWithMessage("接收文件失败", c) return }
类似于这种对错误进行了两次的处理,是否显得冗余

修改建议

在这里是否可以通过直接return err的方式,将错误抛给调用者

@bellingham07 bellingham07 added the bug Something isn't working label Aug 9, 2023
@songzhibin97
Copy link
Member

一个是log 一个是response?

@bypanghu
Copy link
Member

bypanghu commented Aug 9, 2023 via email

@SliverHorn
Copy link
Member

@SliverHorn CC 抄送

这个我给过解决方案你啊,但是不认同啊

@tesun
Copy link
Contributor

tesun commented Aug 31, 2023

这样没问题啊,日志记录的和response给前端的并不会完全一样。

@nanpucoding
Copy link

没啥问题,一个是抛给前端的,一个是记录到日志里做留存的

@flipped-aurora flipped-aurora deleted a comment Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants
@tesun @SliverHorn @songzhibin97 @bypanghu @bellingham07 @nanpucoding and others