-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
peer chaincode query cli error message formatting #4180
Comments
The call to |
Hi @AQBKX I would like to contribute on this. Let me know if I can start. |
hello, first clone https://github.com/hyperledger/fabric-samples/blob/main/full-stack-asset-transfer-guide , and follow docs/SmartContractDev , you will soon watch it, just in doc01 line 316, where error emerges. |
Hi! I would like to work on this. |
Thanks @neonbhai , I've assigned to you! |
Hi |
Description
It seems like the error message returned from the chaincode is encoded and cannot be displayed correctly in Chinese when running the peer's command. The error message looks correct in the server-debug log but when querying through the peer, it returns a decoding error.
The problem could be with the way the error message is presented in the CLI invocation. The line generating the error message could be the cause of the issue, which is located at
fabric/internal/peer/chaincode/common.go
Line 157 in aaf9932
One possible solution to this problem is to use proto.MarshalTextString to insert the protocol buffer response message into the error string. More information about using proto.MarshalTextString can be found at https://pkg.go.dev/github.com/golang/protobuf@v1.5.3/proto#MarshalTextString.
Steps to reproduce
follow the docs to this,
https://github.com/hyperledger/fabric-samples/blob/main/full-stack-asset-transfer-guide/docs/SmartContractDev/01-Exercise-Getting-Started.md?plain=1#L316
and modify the string into
抱歉,资产 ${id} 尚未创建
in https://github.com/hyperledger/fabric-samples/blob/main/full-stack-asset-transfer-guide/contracts/asset-transfer-typescript/src/assetTransfer.ts#L54then can see in sever-debug log
and in org1admin log
the right message should be
The text was updated successfully, but these errors were encountered: