diff options
author | Bas van Kervel <bas@ethdev.com> | 2015-06-29 17:13:28 +0800 |
---|---|---|
committer | Bas van Kervel <bas@ethdev.com> | 2015-06-30 17:20:31 +0800 |
commit | 6fdddc5ac940b6241596e0a2622461148e8a57a0 (patch) | |
tree | 758e4f831c4959131fc4345bcddfcbd0bc12c128 /rpc/api/eth_args.go | |
parent | 02c6af66bfd04f5eb2e2d48a85615e93ea9c9ddc (diff) | |
download | dexon-6fdddc5ac940b6241596e0a2622461148e8a57a0.tar dexon-6fdddc5ac940b6241596e0a2622461148e8a57a0.tar.gz dexon-6fdddc5ac940b6241596e0a2622461148e8a57a0.tar.bz2 dexon-6fdddc5ac940b6241596e0a2622461148e8a57a0.tar.lz dexon-6fdddc5ac940b6241596e0a2622461148e8a57a0.tar.xz dexon-6fdddc5ac940b6241596e0a2622461148e8a57a0.tar.zst dexon-6fdddc5ac940b6241596e0a2622461148e8a57a0.zip |
improved error handling in parsing request
Diffstat (limited to 'rpc/api/eth_args.go')
-rw-r--r-- | rpc/api/eth_args.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go index a75fdbdee..88fc00a6c 100644 --- a/rpc/api/eth_args.go +++ b/rpc/api/eth_args.go @@ -917,7 +917,11 @@ func (args *ResendArgs) UnmarshalJSON(b []byte) (err error) { trans := new(tx) err = json.Unmarshal(data, trans) if err != nil { - return shared.NewDecodeParamError("Unable to parse transaction object.") + return shared.NewDecodeParamError("Unable to parse transaction object") + } + + if trans == nil || trans.tx == nil { + return shared.NewDecodeParamError("Unable to parse transaction object") } gasLimit, gasPrice := trans.GasLimit, trans.GasPrice @@ -936,6 +940,7 @@ func (args *ResendArgs) UnmarshalJSON(b []byte) (err error) { return shared.NewInvalidTypeError("gasLimit", "not a string") } } + args.Tx = trans args.GasPrice = gasPrice args.GasLimit = gasLimit |