From 52ab4e23d8f7fa4b6a67f9552c94b65e9515f962 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sun, 20 Aug 2023 09:51:40 -0700 Subject: [PATCH] improved error logging for sentry --- litellm/utils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index 2aeb09c2a..0468a728f 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -185,12 +185,22 @@ class Logging: litellm_call_id=self.litellm_params["litellm_call_id"], print_verbose=print_verbose, ) - except: + except Exception as e: print_verbose(f"LiteLLM.LoggingError: [Non-Blocking] Exception occurred while logging with integrations {traceback.format_exc}") + print_verbose( + f"LiteLLM.Logging: is sentry capture exception initialized {capture_exception}" + ) + if capture_exception: # log this error to sentry for debugging + capture_exception(e) except: print_verbose( f"LiteLLM.LoggingError: [Non-Blocking] Exception occurred while logging {traceback.format_exc()}" ) + print_verbose( + f"LiteLLM.Logging: is sentry capture exception initialized {capture_exception}" + ) + if capture_exception: # log this error to sentry for debugging + capture_exception(e) def post_call(self, input, api_key, original_response, additional_args={}): # Do something here