Skip to content

Commit

Permalink
throw if no packages are in packages list
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearkatie committed May 22, 2024
1 parent e734712 commit 90b82e2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ Package::Ptr Context::GetPackageByName(std::string name) {
if (name == Package::unpackaged_name()) {
return Package::unpackaged();
}
if (packages_.size() == 0 ) {
throw KeyError("No user-created packages exist");
}
if (packages_.count(name) == 0) {
throw KeyError("Invalid package name " + name);
}
Expand Down

0 comments on commit 90b82e2

Please sign in to comment.