How to send chaincode error to the calling application?

I want to develop an app in which the app makes call to the chaincode and the chaincode returns the transaction status. Now i want this status to be shown on the frontend, on the calling application. How can i do it?

Your comment on this question:

Email me at this address if a comment is added after mine:Email me if a comment is added after mine

Privacy: Your email address will only be used for sending these notifications.

1 answer to this question.

Your answer

Your name to display (optional):

Email me at this address if my answer is selected or commented on:Email me if my answer is selected or commented on

Privacy: Your email address will only be used for sending these notifications.

0 votes

To pass message all the way to the front end, the chaincode should conform to the following APIs:

// Chaincode interface must be implemented by all chaincodes. The fabric runs// the transactions by calling these functions as specified.type Chaincode interface { // Init is called during Instantiate transaction after the chaincode container // has been established for the first time, allowing the chaincode to // initialize its internal data Init(stub ChaincodeStubInterface) pb.Response

// Invoke is called to update or query the ledger in a proposal transaction. // Updated state variables are not committed to the ledger until the // transaction is committed. Invoke(stub ChaincodeStubInterface) pb.Response}

and the pb.Response is:

// A response with a representation similar to an HTTP response that can// be used within another message.type Response struct { // A status code that should follow the HTTP status codes. Status int32 `protobuf:"varint,1,opt,name=status" json:"status,omitempty"` // A message associated with the response code. Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` // A payload that can be used to include metadata with this response. Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`}