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

当err为nil时,输出错误原因 #105

Merged
merged 3 commits into from
Nov 22, 2020
Merged

当err为nil时,输出错误原因 #105

merged 3 commits into from
Nov 22, 2020

Conversation

tianxuanhong
Copy link
Contributor

Signed-off-by: tianxuanhong 523713078@qq.com

Signed-off-by: tianxuanhong <523713078@qq.com>
p.logger.Errorf("Err processing proposal: %s, status: %d, addr: %s \n", err, r.Response.Status, p.Addr)
if r.Response.Status < 200 || r.Response.Status >= 400 {
if err == nil{
p.logger.Errorf("Err processing proposal: %s \n",r.Response)
Copy link
Member

Choose a reason for hiding this comment

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

感谢贡献

这里的case已经被原来76行覆盖了吧?即 err == nil && (r.Response.Status < 200 || r.Reponse.Status >= 400)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个修改是因为 #97 问题,我也遇到了,err为nil时,没看到错误原因。输出r.Response后类似未上传链码错误会输出:"status:500 message:cannot retrieve package for chaincode mycc/v2, error open /var/hyperledger/production/chaincodes/mycc.v2: no such file or directory", 可能会帮助一些遇到类似问题的人清楚问题原因。 原来76行的代码err ==nil &&(r.Response.Status < 200 || r.Reponse.Status >= 400)这个我没注意到是在哪次修改里,最新代码好像不是。。

Copy link
Member

Choose a reason for hiding this comment

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

哦我知道了,这里只需要在原来的76行,把 r.Response.Message 也打印出来,就ok了吧?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

嗯~~好像也行

Copy link
Member

Choose a reason for hiding this comment

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

@tianxuanhong 麻烦更新一下PR吧

@guoger guoger merged commit bc6b0a1 into Hyperledger-TWGC:master Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants