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:
parent
a267535096
commit
7f9330d184
1 changed files with 8 additions and 1 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue