From 22bc981fd5fe54bab2359319e3ec0706e05a8895 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 14 Mar 2022 12:29:23 +0100 Subject: [PATCH] chore(abigen): improve error message when bindings out of sync (#1025) --- ethers-contract/ethers-contract-abigen/src/multi.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ethers-contract/ethers-contract-abigen/src/multi.rs b/ethers-contract/ethers-contract-abigen/src/multi.rs index 7d35eef5..e57f10f8 100644 --- a/ethers-contract/ethers-contract-abigen/src/multi.rs +++ b/ethers-contract/ethers-contract-abigen/src/multi.rs @@ -709,8 +709,9 @@ fn check_file_in_dir(dir: &Path, file_name: &str, expected_contents: &[u8]) -> R let file_path = dir.join(file_name); eyre::ensure!(file_path.is_file(), "Not a file: {}", file_path.display()); - let contents = fs::read(file_path).expect("Unable to read file"); - eyre::ensure!(contents == expected_contents, "file contents do not match"); + let contents = fs::read(&file_path).expect("Unable to read file"); + eyre::ensure!(contents == expected_contents, format!("The contents of `{}` do not match the expected output of the newest `ethers::Abigen` version.\ +This indicates that the existing bindings are outdated and need to be generated again.", file_path.display())); Ok(()) }