From 77bbbadfcd97366a8b0ed5df43350b7df6d52213 Mon Sep 17 00:00:00 2001 From: Marko Jelavic Date: Wed, 6 Mar 2024 10:34:57 +0100 Subject: [PATCH] Returning logger.error and a comment explaining why --- secretsanta/main/funs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/secretsanta/main/funs.py b/secretsanta/main/funs.py index 432642d..83f26ff 100644 --- a/secretsanta/main/funs.py +++ b/secretsanta/main/funs.py @@ -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")