chore(abigen): improve error message when bindings out of sync (#1025)

This commit is contained in:
Matthias Seitz 2022-03-14 12:29:23 +01:00 committed by GitHub
parent 26de793698
commit 22bc981fd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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(())
}