From 648deb83dbd8b8203b0693dffbe963731db72319 Mon Sep 17 00:00:00 2001 From: xeals <dev@xeal.me> Date: Wed, 26 Apr 2023 17:12:24 +1000 Subject: [PATCH] handle error --- bot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index b609cd0..0ae9000 100755 --- a/bot.py +++ b/bot.py @@ -81,7 +81,9 @@ class BotClient(discord.Client): async def _calculate(self, args: list[str]) -> str: proc = sp.run(["node", "calc_main.js", "--"] + args) - msg = proc.stdout + if proc.returncode != 0: + _log.error(f"running calculator: {proc.stderr}") + msg = proc.stdout or "" return msg.strip() def is_replay(self, message: discord.Message) -> bool: