aboutsummaryrefslogtreecommitdiff
path: root/question_of_the_day/errors.py
diff options
context:
space:
mode:
Diffstat (limited to 'question_of_the_day/errors.py')
-rw-r--r--question_of_the_day/errors.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/question_of_the_day/errors.py b/question_of_the_day/errors.py
new file mode 100644
index 0000000..bc08ec8
--- /dev/null
+++ b/question_of_the_day/errors.py
@@ -0,0 +1,20 @@
+class NoSuchSuggestionError(Exception):
+ def __init__(self, suggestion_id: int):
+ self.suggestion_id = suggestion_id
+
+ def __repr__(self):
+ return f"NoSuchSuggestionError({self.suggestion_id})"
+
+ def __str__(self):
+ return f"Error: no suggestion with id {self.suggestion_id} found in suggestion queue."
+
+
+class QuestionLimitReachedError(Exception):
+ def __init__(self, question_limit: int):
+ self.question_limit = question_limit
+
+ def __repr__(self):
+ return f"QuestionLimitReachedError({self.question_limit})"
+
+ def __str__(self):
+ return f"Error: there are already {self.question_limit} questions in the main queue; can't add more."