Skip to content

Commit

Permalink
fix: add error message for a contract package with no contracts (#2762)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Sep 20, 2023
1 parent e3d18bb commit 9701a0c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compiler/noirc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ pub fn compile_contract(
let err = CustomDiagnostic::from_message("Packages are limited to a single contract")
.in_file(FileId::default());
return Err(vec![err]);
} else if contracts.is_empty() {
let err = CustomDiagnostic::from_message(
"cannot compile crate into a contract as it does not contain any contracts",
)
.in_file(FileId::default());
return Err(vec![err]);
};

for contract in contracts {
Expand Down

0 comments on commit 9701a0c

Please sign in to comment.