aboutsummaryrefslogtreecommitdiff
path: root/question_of_the_day/errors.py
diff options
context:
space:
mode:
authorArjun Satarkar <me@arjunsatarkar.net>2024-02-12 23:09:14 +0000
committerArjun Satarkar <me@arjunsatarkar.net>2024-02-12 23:09:14 +0000
commit5735dd0b55c6bf0e398d9f6ca78230871f36efab (patch)
treeddf6430450e10b96a6dc8dabaeefaec6d0f0bbbb /question_of_the_day/errors.py
parentb71b26cf9b32715dd503931180f9c671ba609241 (diff)
downloadaps-cogs-5735dd0b55c6bf0e398d9f6ca78230871f36efab.tar
aps-cogs-5735dd0b55c6bf0e398d9f6ca78230871f36efab.tar.gz
aps-cogs-5735dd0b55c6bf0e398d9f6ca78230871f36efab.zip
question_of_the_day: improve error handling in qotd approve command
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."