From 91c9b1bfe7ea3a6811446c5e90cb12ac32b13a1a Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Thu, 26 Dec 2024 09:57:09 -0500 Subject: [PATCH] fix: Handle SwitchCoder exception in cmd_load --- aider/commands.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/aider/commands.py b/aider/commands.py index 341499fdf..e2de8959a 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -1309,8 +1309,12 @@ class Commands: continue self.io.tool_output(f"\nExecuting: {cmd}") - # catch switchcoder exception and print error that cmd is only supported with interactive /commands ai! - self.run(cmd) + try: + self.run(cmd) + except SwitchCoder: + self.io.tool_error( + f"Command '{cmd}' is only supported in interactive mode, skipping." + ) def completions_raw_save(self, document, complete_event): return self.completions_raw_read_only(document, complete_event)