KomodoPlatform / pycc

Crypto-Conditions for Komodo in Python
5 stars 5 forks source link

feature request: validation error message handling #13

Open Alrighttt opened 4 years ago

Alrighttt commented 4 years ago

When broadcasting a pyCC transaction via komodod's sendrawtransaction command, if the validation fails. We receive this error message:

error code: -26
error message:
16: mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element)

https://github.com/KomodoPlatform/pycc/blob/master/pycc/lib.py#L346 An assertion such at this one will be displayed in stderr, but the user(or wallet or dapp) will have no indication as to why it failed without having access to stdout of komodod.

It would be useful if we were able to relay the exception back to the user by changing this error message.

This function here https://github.com/ssadler/komodo/blob/b926989fa0602093a694b001ad86192fd26a42d0/src/cc/pycc.cpp#L146 is able to print the exception(along with the assert message), so it is likely a good place to start. ex:AssertionError: TODO: nice error message