From 3973b9c8e4c0783360c266a6cf074063f9f7982c Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Fri, 29 Dec 2023 12:31:10 +0530 Subject: [PATCH] (feat) cloudflare - add exception mapping --- litellm/utils.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/litellm/utils.py b/litellm/utils.py index 0b4477eb6..92852f0c3 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -5691,6 +5691,23 @@ def exception_type( response=original_exception.response, ) # Dailed: Error occurred: 400 Request payload size exceeds the limit: 20000 bytes + elif custom_llm_provider == "cloudflare": + if "Authentication error" in error_str: + exception_mapping_worked = True + raise AuthenticationError( + message=f"Cloudflare Exception - {original_exception.message}", + llm_provider="cloudflare", + model=model, + response=original_exception.response, + ) + if "must have required property" in error_str: + exception_mapping_worked = True + raise BadRequestError( + message=f"Cloudflare Exception - {original_exception.message}", + llm_provider="cloudflare", + model=model, + response=original_exception.response, + ) elif custom_llm_provider == "cohere": # Cohere if ( "invalid api token" in error_str