diff --git a/models/message.py b/models/message.py index d77efa52..214553b2 100644 --- a/models/message.py +++ b/models/message.py @@ -89,7 +89,14 @@ async def execute_function(self, plugins: object) -> str: logger = build_logger(__name__) name = self.function_name - args = json.loads(self.function_arguments) + + try: + args = json.loads(self.function_arguments) + except json.JSONDecodeError: + logger.warn( + f"Error decoding JSON args for function {name}: {self.function_arguments}" + ) + return f"Bad JSON format, impossible to execute function {name}" try: res = await getattr(plugins, name)(**args)