From af8bdcd9e0ae438d908997c0b7a9660ecd47a335 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 6 Feb 2025 09:51:31 -0800 Subject: [PATCH] refactor: Simplify exception validation logic in LiteLLMExceptions --- aider/exceptions.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/aider/exceptions.py b/aider/exceptions.py index b9768e742..02617eb3b 100644 --- a/aider/exceptions.py +++ b/aider/exceptions.py @@ -61,17 +61,7 @@ class LiteLLMExceptions: import litellm for var in dir(litellm): - if not var.endswith("Error"): - continue - - ex_info = None - if var in self.exception_names: - for exi in EXCEPTIONS: - if var == exi.name: - ex_info = exi - break - - if strict and not ex_info: + if var.endswith("Error") and var not in self.exception_names: raise ValueError(f"{var} is in litellm but not in aider's exceptions list") ex = getattr(litellm, var)