I have a function on a Solidity contract that does a throw. Eg.
function do(x,y) {
if ( msg.sender != owner )
throw;
// ...
}
In the Truffle environment I have a test js something like:
//.... part of a promise chain
.then(
function (_bool0) {
assert.isTrue(_bool0,"whoops - should be true");
return contract.do( "okdoke" , {from: accounts[1]} );
}).then(
function (tx_id) {
//..
done();
}
// ...
The return contract.do() causes the condition that results in the throw. Which produces the following in the Truffle test output for this test:
Error: VM Exception while executing transaction: invalid JUMP
What is the idiom for handling a throw from a contract function in a test like this? The throw is the correct behavior.