provide dice_str in exceptions, where applicable

This commit is contained in:
Brian S. Stephan 2019-06-29 09:24:16 -05:00
parent b917f78ca5
commit abce0262f3

View File

@ -31,6 +31,6 @@ def rpc_roll_dice(request):
result_str = roller.do_roll(dice_str) result_str = roller.do_roll(dice_str)
return Response({'dice': dice_str, 'result': result_str}) return Response({'dice': dice_str, 'result': result_str})
except AssertionError as aex: except AssertionError as aex:
return Response({'detail': f"Could not roll dice: {aex}"}, status=400) return Response({'detail': f"Could not roll dice: {aex}", 'dice': dice_str}, status=400)
except ValueError: except ValueError:
return Response({'detail': f"Could not parse requested dice '{dice_str}'."}, status=400) return Response({'detail': f"Could not parse requested dice '{dice_str}'.", 'dice': dice_str}, status=400)