Browse Source

better error handling of rpc errors

cl-refactor
arkpar 10 years ago
parent
commit
de90fb6637
  1. 71
      mix/ClientModel.cpp

71
mix/ClientModel.cpp

@ -451,42 +451,7 @@ void ClientModel::executeSequence(vector<TransactionSettings> const& _sequence)
onNewTransaction();
TransactionException exception = m_client->lastExecution().excepted;
if (exception != TransactionException::None)
{
switch (m_client->lastExecution().excepted)
{
case TransactionException::None:
break;
case TransactionException::NotEnoughCash:
emit runFailed("Insufficient balance for contract deployment");
break;
case TransactionException::OutOfGasIntrinsic:
case TransactionException::OutOfGasBase:
case TransactionException::OutOfGas:
emit runFailed("Not enough gas");
break;
case TransactionException::BlockGasLimitReached:
emit runFailed("Block gas limit reached");
break;
case TransactionException::BadJumpDestination:
emit runFailed("Solidity exception (bad jump)");
break;
case TransactionException::OutOfStack:
emit runFailed("Out of stack");
break;
case TransactionException::StackUnderflow:
emit runFailed("Stack underflow");
//these should not happen in mix
case TransactionException::Unknown:
case TransactionException::BadInstruction:
case TransactionException::InvalidSignature:
case TransactionException::InvalidNonce:
case TransactionException::InvalidFormat:
case TransactionException::BadRLP:
emit runFailed("Internal execution error");
break;
}
break;
}
}
emit runComplete();
}
@ -802,6 +767,42 @@ void ClientModel::onStateReset()
void ClientModel::onNewTransaction()
{
ExecutionResult const& tr = m_client->lastExecution();
switch (tr.excepted)
{
case TransactionException::None:
break;
case TransactionException::NotEnoughCash:
emit runFailed("Insufficient balance for contract deployment");
break;
case TransactionException::OutOfGasIntrinsic:
case TransactionException::OutOfGasBase:
case TransactionException::OutOfGas:
emit runFailed("Not enough gas");
break;
case TransactionException::BlockGasLimitReached:
emit runFailed("Block gas limit reached");
break;
case TransactionException::BadJumpDestination:
emit runFailed("Solidity exception (bad jump)");
break;
case TransactionException::OutOfStack:
emit runFailed("Out of stack");
break;
case TransactionException::StackUnderflow:
emit runFailed("Stack underflow");
//these should not happen in mix
case TransactionException::Unknown:
case TransactionException::BadInstruction:
case TransactionException::InvalidSignature:
case TransactionException::InvalidNonce:
case TransactionException::InvalidFormat:
case TransactionException::BadRLP:
emit runFailed("Internal execution error");
break;
}
unsigned block = m_client->number() + 1;
unsigned recordIndex = tr.executonIndex;
QString transactionIndex = tr.isCall() ? QObject::tr("Call") : QString("%1:%2").arg(block).arg(tr.transactionIndex);

Loading…
Cancel
Save