Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions langfuse/_utils/parse_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
SUPPORT_URL = "https://langfuse.com/support"
API_DOCS_URL = "https://api.reference.langfuse.com"
RBAC_DOCS_URL = "https://langfuse.com/docs/rbac"
INSTALLATION_DOCS_URL = "https://langfuse.com/docs/sdk/typescript/guide"
CREDENTIAL_SETUP_URL = (
"https://langfuse.com/docs/observability/sdk/overview#configure-credentials"
)
RATE_LIMITS_URL = "https://langfuse.com/faq/all/api-limits"
PYPI_PACKAGE_URL = "https://pypi.org/project/langfuse/"

Expand All @@ -31,8 +33,9 @@
504: f"Gateway timeout. {defaultServerErrorPrompt}",
404: f"Internal error occurred. {defaultServerErrorPrompt}",
400: f"Bad request. Please check your request for any missing or incorrect parameters. Refer to our API docs: {API_DOCS_URL} for details.",
401: f"Unauthorized. Please check your public/private host settings. Refer to our installation and setup guide: {INSTALLATION_DOCS_URL} for details on SDK configuration.",
401: f"Unauthorized. Check LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, and LANGFUSE_BASE_URL. See the SDK credential setup guide: {CREDENTIAL_SETUP_URL}",
403: f"Forbidden. Please check your access control settings. Refer to our RBAC docs: {RBAC_DOCS_URL} for details.",
405: f"Method not allowed. Check LANGFUSE_BASE_URL and whether your server version supports this endpoint. For help, contact support: {SUPPORT_URL}",
429: f"Rate limit exceeded. For more information on rate limits please see: {RATE_LIMITS_URL}",
}

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_error_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_generate_error_message_access_denied_error():

def test_generate_error_message_method_not_allowed_error():
exception = MethodNotAllowedError(body={})
expected_message = "Unexpected error occurred. Please check your request and contact support: https://langfuse.com/support."
expected_message = "Method not allowed. Check LANGFUSE_BASE_URL and whether your server version supports this endpoint. For help, contact support: https://langfuse.com/support"
assert generate_error_message_fern(exception) == expected_message


Expand All @@ -31,7 +31,7 @@ def test_generate_error_message_not_found_error():

def test_generate_error_message_unauthorized_error():
exception = UnauthorizedError(body={})
expected_message = "Unauthorized. Please check your public/private host settings. Refer to our installation and setup guide: https://langfuse.com/docs/sdk/typescript/guide for details on SDK configuration."
expected_message = "Unauthorized. Check LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, and LANGFUSE_BASE_URL. See the SDK credential setup guide: https://langfuse.com/docs/observability/sdk/overview#configure-credentials"
assert generate_error_message_fern(exception) == expected_message


Expand Down
Loading