-
Notifications
You must be signed in to change notification settings - Fork 763
fix: handle provider error logs addition #1241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR improves error handling by adding detailed logging and standardizing error responses. I have one suggestion to enhance the error logging format for better readability and analysis.
|
||
this.updateHeaders(finalMappedResponse, cache.cacheStatus, retryAttempt); | ||
|
||
if (!finalMappedResponse.ok) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of throwing error, tryPost will return it just as a simple response as throwing error is redundant.
In tryTargetsRecursively, we are already checking for response.ok
}, | ||
} | ||
); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this PR removes the throw new Error() logic in tryPost for LLM failures, we no longer need to set it here. If the any error is caught, they will always be an Gateway exception.
Important PR Review SkippedPR review skipped as per the configuration setting. Run a manually review by commenting /matter review 💡Tips to use Matter AICommand List
|
Description
logObject.log() method is not getting called for error responses because responseService.create() throws an error with response details for all non-2xx LLM error responses. This causes issues with keeping track of logObjects of failed requests.
It is redundant to throw the error from responseService, because it is simply getting caught and then the same value is used in the final response object of tryTargetsRecursively function.
With this change, tryTargetsRecursively catch block should only be used when there is an actual gateway exception. For all provider non-2xx responses, they will be treated as a valid response.
Motivation
Fix on top of #1121
Type of Change
How Has This Been Tested?
Screenshots (if applicable)
Checklist
Related Issues