Skip to content

How can I get chaincode error message? #526

@hoskylucky

Description

@hoskylucky

I wrote a chaincode that includes an add operation and returns an error if the "Id" already exists. When using the gateway-api, the Proposal's Endorse method returns an error message, but it is not the error message returned by the chaincode. How can I get the error message from the chaincode?
Here is logs of peer:

2023-01-18 06:11:07.802 UTC 020b WARN [gateway] func1 -> Endorse call to endorser failed channel=dwzq-fabric-app-channel1 chaincode=redis_like txID=7122bcb2b6eb94d4e0c45d5b0d5e7fb831a5c54ca7840af7cccd269f38bb3c0c endorserAddress=peer1.org1.fabric.dwstock.com:7051 endorserMspid=Org1Msp error="**chaincode response 500, the asset id4 already exists**"
2023-01-18 06:11:07.802 UTC 020c INFO [comm.grpc.server] 1 -> unary call completed grpc.service=gateway.Gateway grpc.method=Endorse grpc.request_deadline=2023-01-18T06:11:22.798Z grpc.peer_address=172.23.0.1:41264 error="rpc error: code = Aborted desc = failed to endorse transaction, see attached details for more info" grpc.code=Aborted grpc.call_duration=3.316665ms

How can I get "the asset id4 already exists" message?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions