Remove generic exceptions

This commit is contained in:
PapaTutuWawa committed 2025-04-21 14:24:13 +02:00
1 parent 969921dd79
commit f55542cf18
2 files changed
+13 -4

No files matched your search

+3 -4
View File
@@ -1,5 +1,6 @@
import xmpp_api.api.types.v1.bot as bot_api
import xmpp_api.db.bot as bot_db
from xmpp_api.exceptions.base import UnknownConstraintException
def bot_constraint_to_db(constraint: bot_api.BotConstraint) -> bot_db.BotConstraint:
@@ -9,8 +10,7 @@ def bot_constraint_to_db(constraint: bot_api.BotConstraint) -> bot_db.BotConstra
domains=constraint.domains,
)
case _:
# TODO: Proper exception type
raise Exception()
raise UnknownConstraintException(constraint.__class__.__name__)
def bot_constraint_from_db(constraint: bot_db.BotConstraint) -> bot_api.BotConstraint:
@@ -20,5 +20,4 @@ def bot_constraint_from_db(constraint: bot_db.BotConstraint) -> bot_api.BotConst
domains=constraint.domains,
)
case _:
# TODO: Proper exception type
raise Exception()
raise UnknownConstraintException(constraint.__class__.__name__)