chore(solc): improve checksum error message (#1394)
This commit is contained in:
parent
e262e5d758
commit
d09845e0c5
|
@ -457,8 +457,10 @@ impl Solc {
|
||||||
if checksum_calc == checksum_found {
|
if checksum_calc == checksum_found {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
tracing:: warn!(target : "solc", "checksum mismatch for {:?}, expected {}, but found {} for file {:?}", version, hex::encode(&checksum_found), hex::encode(checksum_calc), version_path);
|
let expected = hex::encode(&checksum_found);
|
||||||
Err(SolcError::ChecksumMismatch)
|
let detected = hex::encode(checksum_calc);
|
||||||
|
tracing:: warn!(target : "solc", "checksum mismatch for {:?}, expected {}, but found {} for file {:?}", version, expected, detected, version_path);
|
||||||
|
Err(SolcError::ChecksumMismatch { version, expected, detected, file: version_path })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use semver::Version;
|
||||||
use std::{io, path::PathBuf};
|
use std::{io, path::PathBuf};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
@ -13,8 +14,8 @@ pub enum SolcError {
|
||||||
PragmaNotFound,
|
PragmaNotFound,
|
||||||
#[error("Could not find solc version locally or upstream")]
|
#[error("Could not find solc version locally or upstream")]
|
||||||
VersionNotFound,
|
VersionNotFound,
|
||||||
#[error("Checksum mismatch")]
|
#[error("Checksum mismatch for {file}: expected {expected} found {detected} for {version}")]
|
||||||
ChecksumMismatch,
|
ChecksumMismatch { version: Version, expected: String, detected: String, file: PathBuf },
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
SemverError(#[from] semver::Error),
|
SemverError(#[from] semver::Error),
|
||||||
/// Deserialization error
|
/// Deserialization error
|
||||||
|
|
Loading…
Reference in New Issue