Skip to content

Commit ec205aa

Browse files
authored
feat: more user-friendly error when no compiler is available (#185)
Currently, if no Vyper or Solidity compiler is available, returned error would look like: ``` Found incompatible Solidity versions: src/a.vy imports: src/b.vy Found incompatible Solidity versions: src/b.vy imports: ... ``` This PR adds logic for catching case when the error is caused by missing compiler for the language
1 parent c40158d commit ec205aa

File tree

1 file changed

+7
-1
lines changed
  • crates/compilers/src/resolver

1 file changed

+7
-1
lines changed

crates/compilers/src/resolver/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,12 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
633633
compiler.available_versions(&language)
634634
};
635635

636+
if all_versions.is_empty() && !nodes.is_empty() {
637+
return Err(SolcError::msg(format!(
638+
"Found {language} sources, but no compiler versions are available for it"
639+
)));
640+
}
641+
636642
// stores all versions and their nodes that can be compiled
637643
let mut versioned_nodes = HashMap::new();
638644

@@ -656,7 +662,7 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
656662
} else {
657663
let mut msg = String::new();
658664
self.format_imports_list(idx, &mut msg).unwrap();
659-
errors.push(format!("Found incompatible Solidity versions:\n{msg}"));
665+
errors.push(format!("Found incompatible versions:\n{msg}"));
660666
}
661667

662668
erroneous_nodes.insert(idx);

0 commit comments

Comments
 (0)