1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Send dice error messages

This commit is contained in:
Steffo 2019-10-25 13:48:14 +02:00
parent a267535096
commit 7f9330d184

View file

@ -13,7 +13,14 @@ class DiceCommand(Command):
async def run(self, args: CommandArgs, data: CommandData) -> None: async def run(self, args: CommandArgs, data: CommandData) -> None:
dice_str = args.joined(require_at_least=1) dice_str = args.joined(require_at_least=1)
roll = dice.roll(dice_str) try:
roll = dice.roll(dice_str)
except dice.DiceFatalException as e:
raise CommandError(e.msg)
except dice.DiceException as e:
raise CommandError(e.msg)
except dice.DiceBaseException as e:
raise CommandError(str(e))
try: try:
result = list(roll) result = list(roll)
except TypeError: except TypeError: