-
Notifications
You must be signed in to change notification settings - Fork 0
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
[DSET-4072] Include (truncated) response body in the error message in case we fail to parse the response body #29
Conversation
error message in case we fail to parse the response body as JSON. This will make troubleshooting various edge cases easier.
Codecov Report
@@ Coverage Diff @@
## main #29 +/- ##
==========================================
+ Coverage 73.42% 73.72% +0.31%
==========================================
Files 10 10
Lines 1358 1370 +12
==========================================
+ Hits 997 1010 +13
+ Misses 302 299 -3
- Partials 59 61 +2
|
this URL when sending the requests. Also include it with the error messages to make troubleshooting easier.
I noticed build failed the first time during CI/CD run so I assume there is still some kind of race condition going on during the tests. |
I pushed another change so we also log addEvents URL which is used in the errors to make troubleshooting easier. In ideal world, we would refactor this code some more and have base struct / class for API errors which would carry all the context (response status code, body, endpoint url, request method, etc.) and utilize this everywhere for consistent and useful log and error messages. |
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.
But otherwise looks good. :)
…cated_body_on_error
This pull request updates
apiCall()
function to also log partial raw response body in case we fail to parse response body as JSON.This will help troubleshooting various edge cases when the API doesn't return valid JSON.