kadena-io / kda-tool

CLI interface to the the Kadena blockchain
https://kadena.io/
BSD 3-Clause "New" or "Revised" License
11 stars 1 forks source link

Improvement: Return exit codes when transaction fail #12

Closed CryptoPascal31 closed 1 year ago

CryptoPascal31 commented 1 year ago

I've just started to use the kda-tool to make automatic deployment:

https://github.com/CryptoPascal31/pact-util-lib

And I have some suggestions.

kda-tool should return a specific exit code (different from 0) for the local, send, and poll commands, when one of the transactions has failed.

This would help a lot to automatize things (especially in Makefile) to detect when something goes wrong in the workflow.

mightybyte commented 1 year ago

There are at least a couple difficulties here:

  1. There are multiple ways to define success/failure. The tool already returns error codes for certain failures such as parsing, talking to the node, etc (see https://github.com/kadena-io/kda-tool/blob/master/src/Commands/Local.hs#L49). To really assess a transaction's blockchain success status you really need to dig into the returned output in more detail.
  2. How to handle the case of multiple transactions. I've created PR #22 that does the simplest thing. But there are plenty of more involved situations where you'll have to parse the JSON output and make decision appropriate to each unique situation.
mightybyte commented 1 year ago

Closed by PR #22