Add error for sendRawTransaction and estimateGas (#3194)

* sendRawTransaction invalid RLP error

* Returning proper error for estimate_gas
This commit is contained in:
Tomasz Drwięga
2016-11-04 18:33:10 +01:00
committed by Arkadiy Paronyan
parent 2563189316
commit 501b2cdd18
3 changed files with 36 additions and 8 deletions

View File

@@ -21,6 +21,7 @@ macro_rules! rpc_unimplemented {
}
use std::fmt;
use rlp::DecoderError;
use ethcore::error::{Error as EthcoreError, CallError};
use ethcore::account_provider::{Error as AccountError};
use fetch::FetchError;
@@ -271,6 +272,14 @@ pub fn from_transaction_error(error: EthcoreError) -> Error {
}
}
pub fn from_rlp_error(error: DecoderError) -> Error {
Error {
code: ErrorCode::InvalidParams,
message: "Invalid RLP.".into(),
data: Some(Value::String(format!("{:?}", error))),
}
}
pub fn from_call_error(error: CallError) -> Error {
match error {
CallError::StatePruned => state_pruned(),