From 5e55ee2402eeef10fa685d88314fc57925c444cc Mon Sep 17 00:00:00 2001 From: XxAlonexX Date: Tue, 11 Mar 2025 23:31:47 +0530 Subject: [PATCH] Done with the requested changes --- litellm/_logging.py | 5 ++++- litellm/llms/openai_like/common_utils.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/litellm/_logging.py b/litellm/_logging.py index 151ae6003d..757bbf5e73 100644 --- a/litellm/_logging.py +++ b/litellm/_logging.py @@ -35,7 +35,10 @@ class JsonFormatter(Formatter): } if record.exc_info: - json_record["stacktrace"] = self.formatException(record.exc_info) + try: + json_record["stacktrace"] = self.formatException(record.exc_info) + except Exception as e: + json_record["stacktrace"] = f"Error serializing stacktrace: {str(e)}" return json.dumps(json_record) diff --git a/litellm/llms/openai_like/common_utils.py b/litellm/llms/openai_like/common_utils.py index c05e0c8e8d..7cce7b43b2 100644 --- a/litellm/llms/openai_like/common_utils.py +++ b/litellm/llms/openai_like/common_utils.py @@ -9,7 +9,7 @@ class OpenAILikeError(Exception): self.message = message self.request = request self.response = response - super().__init__(self.message) # Call the base class constructor with the parameters it needs + super().__init__(message) # Call the base class constructor with the parameters it needs class OpenAILikeBase: