Skip to content

Commit

Permalink
perfect: Change exception type to std::out_of_range in PerfectPlayer:…
Browse files Browse the repository at this point in the history
…:eval

In the PerfectPlayer::eval method, the exception thrown when a key is not found in
the 'secs' map has been changed from std::runtime_error to std::out_of_range. This
aligns with the handling of similar exceptions elsewhere in the code, providing
consistency and clearer error messaging about missing database files.

Reference: ggevay/malom#3 (comment)
Change-Id: Ic860087ebf2d7e714b58f0c2ad78c05250434152
  • Loading branch information
calcitem committed Dec 25, 2023
1 parent 6b86346 commit 52cb036
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/perfect/perfect_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ Wrappers::gui_eval_elem2 PerfectPlayer::eval(GameState s)

auto it = secs.find(Id);
if (it == secs.end()) {
throw std::runtime_error("Key not found in map");
throw std::out_of_range("Database file for the key not found");
}

Wrappers::WSector &sec = it->second;
Expand Down

0 comments on commit 52cb036

Please sign in to comment.