chore(solc): improve file not found error (#1611)
This commit is contained in:
parent
4f6ccf70b3
commit
6f1d47f3aa
|
@ -32,6 +32,13 @@ pub enum SolcError {
|
||||||
Resolve(SolcIoError),
|
Resolve(SolcIoError),
|
||||||
#[error("File could not be resolved due to broken symlink: {0}.")]
|
#[error("File could not be resolved due to broken symlink: {0}.")]
|
||||||
ResolveBadSymlink(SolcIoError),
|
ResolveBadSymlink(SolcIoError),
|
||||||
|
#[error(
|
||||||
|
r#"Failed to resolve file: {0}.
|
||||||
|
--> {1:?}
|
||||||
|
{2:?}
|
||||||
|
Check configured remappings."#
|
||||||
|
)]
|
||||||
|
FailedResolveImport(SolcIoError, PathBuf, PathBuf),
|
||||||
#[cfg(feature = "svm-solc")]
|
#[cfg(feature = "svm-solc")]
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
SvmError(#[from] svm::SolcVmError),
|
SvmError(#[from] svm::SolcVmError),
|
||||||
|
|
|
@ -368,7 +368,20 @@ impl Graph {
|
||||||
&mut resolved_solc_include_paths,
|
&mut resolved_solc_include_paths,
|
||||||
) {
|
) {
|
||||||
Ok(import) => {
|
Ok(import) => {
|
||||||
add_node(&mut unresolved, &mut index, &mut resolved_imports, import)?;
|
add_node(&mut unresolved, &mut index, &mut resolved_imports, import)
|
||||||
|
.map_err(|err| {
|
||||||
|
match err {
|
||||||
|
SolcError::Resolve(err) => {
|
||||||
|
// make the error more verbose
|
||||||
|
SolcError::FailedResolveImport(
|
||||||
|
err,
|
||||||
|
node.path.clone(),
|
||||||
|
import_path.clone(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
_ => err,
|
||||||
|
}
|
||||||
|
})?
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
unresolved_imports.insert((import_path.to_path_buf(), node.path.clone()));
|
unresolved_imports.insert((import_path.to_path_buf(), node.path.clone()));
|
||||||
|
|
Loading…
Reference in New Issue