Refine error handling for LLM factories config
Improve exception handling to provide more specific and detailed error handling, aiding debugging and troubleshooting.
This commit is contained in:
parent
f0a14f5fce
commit
3fea134d86
1 changed files with 11 additions and 1 deletions
|
|
@ -179,7 +179,17 @@ def init_settings():
|
|||
try:
|
||||
with open(os.path.join(get_project_base_directory(), "conf", "llm_factories.json"), "r") as f:
|
||||
FACTORY_LLM_INFOS = json.load(f)["factory_llm_infos"]
|
||||
except Exception:
|
||||
except FileNotFoundError:
|
||||
logging.warning(f"LLM factories config not found at {config_path}")
|
||||
FACTORY_LLM_INFOS = []
|
||||
except KeyError:
|
||||
logging.warning("Invalid LLM factories config format")
|
||||
FACTORY_LLM_INFOS = []
|
||||
except json.JSONDecodeError:
|
||||
logging.error("Invalid JSON in LLM factories config")
|
||||
FACTORY_LLM_INFOS = []
|
||||
except Exception as e:
|
||||
logging.error(f"Unexpected error loading LLM factories config: {e}")
|
||||
FACTORY_LLM_INFOS = []
|
||||
|
||||
global API_KEY
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue