Improved local tx error messages (RIPD-720)

Failed local built transactions report the specific error.
This commit is contained in:
Miguel Portilla
2015-03-23 13:45:08 -04:00
committed by Tom Ritchford
parent 1fedede771
commit 5e70db651d
8 changed files with 56 additions and 55 deletions

View File

@@ -64,23 +64,12 @@ Json::Value doSubmit (RPC::Context& context)
}
Transaction::pointer tpTrans;
try
{
tpTrans = std::make_shared<Transaction> (stpTrans, Validate::YES);
}
catch (std::exception& e)
{
jvResult[jss::error] = "internalTransaction";
jvResult[jss::error_exception] = e.what ();
return jvResult;
}
std::string reason;
tpTrans = std::make_shared<Transaction> (stpTrans, Validate::YES, reason);
if (tpTrans->getStatus() != NEW)
{
jvResult[jss::error] = "invalidTransactions";
jvResult[jss::error_exception] = "fails local checks";
jvResult[jss::error] = "invalidTransaction";
jvResult[jss::error_exception] = "fails local checks: " + reason;
return jvResult;
}

View File

@@ -485,17 +485,8 @@ transactionSign (
stpTrans->sign (keypair.secretKey);
Transaction::pointer tpTrans;
try
{
tpTrans = std::make_shared<Transaction> (stpTrans, Validate::NO);
}
catch (std::exception&)
{
return RPC::make_error (rpcINTERNAL,
"Exception occurred during transaction");
}
Transaction::pointer tpTrans = std::make_shared<Transaction> (stpTrans,
Validate::NO, reason);
try
{