diff --git a/CHANGELOG.md b/CHANGELOG.md index 75cbb6a8..ff174341 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Unreleased -- Add `evm.deployedBytecode.immutableReferences` output selector [#1523](https://github.com/gakonst/ethers-rs/pull/1523) +- Add `evm.deployedBytecode.immutableReferences` output selector [#1523](https://github.com/gakonst/ethers-rs/pull/1523) - Added `get_erc1155_token_transfer_events` function for etherscan client [#1503](https://github.com/gakonst/ethers-rs/pull/1503) - Add support for Geth `debug_traceTransaction` [#1469](https://github.com/gakonst/ethers-rs/pull/1469) - Use correct, new transaction type for `typool_content` RPC endpoint [#1501](https://github.com/gakonst/ethers-rs/pull/1501) @@ -104,6 +104,8 @@ `my_contract` rather than `mycontract_mod`. - The `Cargo.toml` generated by bindings now includes the `abigen` feature on ethers. [#1508](https://github.com/gakonst/ethers-rs/pull/1508) +- More descriptive contract deserialization errors. + [#1633](https://github.com/gakonst/ethers-rs/pull/1633) ### 0.6.0 diff --git a/ethers-contract/ethers-contract-abigen/src/contract.rs b/ethers-contract/ethers-contract-abigen/src/contract.rs index 7ce03b73..885b348a 100644 --- a/ethers-contract/ethers-contract-abigen/src/contract.rs +++ b/ethers-contract/ethers-contract-abigen/src/contract.rs @@ -191,7 +191,9 @@ impl Context { // holds the bytecode parsed from the abi_str, if present let mut contract_bytecode = None; - let (abi, human_readable, abi_parser) = parse_abi(&abi_str)?; + let (abi, human_readable, abi_parser) = parse_abi(&abi_str).wrap_err_with(|| { + eyre::eyre!("error parsing abi for contract: {}", args.contract_name) + })?; // try to extract all the solidity structs from the normal JSON ABI // we need to parse the json abi again because we need the internalType fields which are @@ -351,7 +353,8 @@ fn parse_abi(abi_str: &str) -> Result<(Abi, bool, AbiParser)> { (abi, true, abi_parser) } else { // a best-effort coercion of an ABI or an artifact JSON into an artifact JSON. - let contract: JsonContract = serde_json::from_str(abi_str)?; + let contract: JsonContract = serde_json::from_str(abi_str) + .wrap_err_with(|| eyre::eyre!("failed deserializing abi:\n{}", abi_str))?; (contract.into_abi(), false, abi_parser) };