From 9661191202903df96147d69a61830c69ef319012 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 28 Feb 2025 16:13:15 -0800 Subject: [PATCH] test_get_error_information --- litellm/litellm_core_utils/litellm_logging.py | 1 - litellm/types/utils.py | 1 - tests/logging_callback_tests/test_standard_logging_payload.py | 1 + ui/litellm-dashboard/src/components/view_logs/ErrorViewer.tsx | 3 +-- ui/litellm-dashboard/src/components/view_logs/index.tsx | 4 ++-- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index a1a78f16502..5a0a9c55efd 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -3133,7 +3133,6 @@ class StandardLoggingPayloadSetup: error_class=error_class, llm_provider=_llm_provider_in_exception, traceback=traceback_info, - status_code=getattr(original_exception, "status_code", None), error_message=error_message if original_exception else "", ) diff --git a/litellm/types/utils.py b/litellm/types/utils.py index c8b8d2b5a10..dcaf5f35d19 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -1607,7 +1607,6 @@ class StandardLoggingPayloadErrorInformation(TypedDict, total=False): error_class: Optional[str] llm_provider: Optional[str] traceback: Optional[str] - status_code: Optional[int] error_message: Optional[str] diff --git a/tests/logging_callback_tests/test_standard_logging_payload.py b/tests/logging_callback_tests/test_standard_logging_payload.py index 084be4756bc..07871d3eead 100644 --- a/tests/logging_callback_tests/test_standard_logging_payload.py +++ b/tests/logging_callback_tests/test_standard_logging_payload.py @@ -413,6 +413,7 @@ def test_get_error_information(): assert result["error_code"] == "429" assert result["error_class"] == "RateLimitError" assert result["llm_provider"] == "openai" + assert result["error_message"] == "litellm.RateLimitError: Test error" def test_get_response_time(): diff --git a/ui/litellm-dashboard/src/components/view_logs/ErrorViewer.tsx b/ui/litellm-dashboard/src/components/view_logs/ErrorViewer.tsx index 8ada7d2da8a..69d2bea28b9 100644 --- a/ui/litellm-dashboard/src/components/view_logs/ErrorViewer.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/ErrorViewer.tsx @@ -4,10 +4,9 @@ interface ErrorViewerProps { errorInfo: { error_class?: string; error_message?: string; - status_code?: string | number; traceback?: string; llm_provider?: string; - error_code?: string; + error_code?: string | number; }; } diff --git a/ui/litellm-dashboard/src/components/view_logs/index.tsx b/ui/litellm-dashboard/src/components/view_logs/index.tsx index 4aad28633ab..6083e7dad00 100644 --- a/ui/litellm-dashboard/src/components/view_logs/index.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/index.tsx @@ -588,7 +588,7 @@ function RequestViewer({ row }: { row: Row }) { error: { message: errorInfo.error_message || "An error occurred", type: errorInfo.error_class || "error", - code: errorInfo.error_code || errorInfo.status_code || "unknown", + code: errorInfo.error_code || "unknown", param: null } }; @@ -688,7 +688,7 @@ function RequestViewer({ row }: { row: Row }) { Response {hasError && ( - • HTTP code {errorInfo?.status_code || 400} + • HTTP code {errorInfo?.error_code || 400} )}