Skip to content

Commit

Permalink
Returning logger.error and a comment explaining why
Browse files Browse the repository at this point in the history
  • Loading branch information
mirai-mjelavic committed Mar 6, 2024
1 parent 98a3e60 commit 77bbbad
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions secretsanta/main/funs.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def make_santa_dict(dictionary: Dict[str, str], seed: Optional[int] = None,
np.random.seed(seed)

if len(dictionary) == 1:
# Despite this often being perceived as an anti-pattern, we want the exception to be shown in log files also.
logger.error("Only one person listed")
raise ValueError("Only one person listed")
if len(dictionary) <= 3:
logger.warning("Too few people, assignment will be deterministic")
Expand Down

0 comments on commit 77bbbad

Please sign in to comment.