Returning errors from Invoke functions #85
Comments
@JoseMiguelHerrera the call to invoke() returns 200 OK immediately with a transaction ID to indicate a successful call to invoke function and does not represent the result of the function. You will have to use eventhub or call block api to see if the transaction was successful. |
@mrshah-at-ibm thanks for the quick response, I'm glad it's possible to get the response somehow. |
Here is an example - https://github.com/IBM-Blockchain/SDK-Demo |
@mrshah-at-ibm in this demo there isn't a way to get back errors propagated from the chaincode.
Then I went into config.json to get rid of an invoke argument, reducing them to 2. If there is a way (maybe with the "custom event listening"), the demo isn't doing it. |
I gave it a try with the event hub custom events but I'm not sure if I use it to simulate getting back errors.
Is there a design pattern that can simply tell me right away which error an invoke threw? |
I haven't used it much, thus I am not sure if it can give back the exact error. |
closing due to inactivity |
Hi There,
I've been noticing that there is a difference in the way errors are returned in the chaincode between invoke() and query().
When I return an error like so:
return nil, errors.New("generic error")
the error is propagated properly only when the error came from a function called through query().
However, when called through invoke(), there is no apparent way to detect the error. When I try it from the Blockchain API portal, I simply get a 200 OK response... and through the HFC library it simply times out.
Getting error signals back from the chaincode/smart contract is very important, so what is happening?
Cheers,
Jose Herrera
The text was updated successfully, but these errors were encountered: