Repository navigation
fix(langchain): fallback to exception class name when error message is empty - #2093
Open
viliamgonda wants to merge 1 commit into
Open
viliamgonda wants to merge 1 commit into
viliamgonda wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes langfuse/langfuse#19599
In
LangchainCallbackHandler._get_error_level_and_status_message, ordinary exceptions only returnedstr(error)as the status message. For exceptions with an empty string representation (such asValueError(),TimeoutError(), or custom exceptions without a message), the observation level was marked as"ERROR"butstatusMessageremained empty (""), making the root exception type invisible in traces.This change:
_get_error_level_and_status_messageto fall back totype(error).__name__whenstr(error)is empty (str(error) or type(error).__name__), matching the existing fallback used for control flow exceptions.test_error_without_message_uses_exception_type_as_status_messageintests/unit/test_langchain.py.Type of change
Verification
List the main commands you ran:
Checklist
code_review.md..env.templateif needed.

Confidence Score: 5/5
This PR appears safe to merge.Summary
Ordinary exceptions with empty messages now use their class name as the status message.
Reviews (1) · Last reviewed commit: "fix(langchain): fallback to exception cl..." · Reviewed by Greptile