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-29 17:13:28 +0800 |
commit | a355777ff8531ba91fbdfb093532e7314c15710b (patch) | |
tree | 1f9dd19a81f5391e1416fe4502b235b6abf4aca2 /rpc/api/eth_args.go | |
parent | ee73f09727004e94a04a396b99151ab79fd187f4 (diff) | |
download | dexon-a355777ff8531ba91fbdfb093532e7314c15710b.tar.gz dexon-a355777ff8531ba91fbdfb093532e7314c15710b.tar.zst dexon-a355777ff8531ba91fbdfb093532e7314c15710b.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 |