I have built a contract which provides a simple method for storing some data in a property of my contract on the blockchain.
I can interface with my contract using web3.js and I have no issue doing so.
The problem is that I only want to be able to set the property if it has NOT already been set. As such the contract method checks for a zero value and returns an arbitrary error code ("0001") if it has already been set. If it has not been set "0000" is returned.
When I execute the method (through javascript) my callback is immediately called. The result contains the transaction hash for an as of yet unmined transaction. When the transaction is mined there are no further calls to the callback, and at no point is the error code (mentioned above) made available asynchronously within my javascript code.
As such I can not update my interface accordingly when there is an 'error'.
I can poll the transaction hash and check for the point at which it is mined, but because even in the error case the transaction is mined, this is of little use.
web3.js loses a lot of its utility if there is no way of discerning the response of mining a transaction on the blockchain. Have I missed something?
Thanks