Add information about requested URL to UnexpectedResponse exception to simplify troubleshooting
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 304
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 37
Description
If you specify an incorrect URL for the QdrantClient, and make a call to the server such as upsert the request will fail with an exception.
The exception does not specify which server it tried to call, only the response.
If for example, you specify the URL for a web server that is not the cluster server (e.g. one of the nodes) you can get an exception with HTTP status 404 "not found" like this when you call upsert:
qdrant_client.http.exceptions.UnexpectedResponse: Unexpected Response: 404 (Not Found)
Raw response content:
b'404 page not found\n'
To make troubleshooting configuration mistakes easier, it would be nice to include the actual URL in the exception.
Proposed Solution
The exception comes from the send function in api_client.py.
One solution would be to add an optional url field to UnexpectedResponse in exceptions.py and rewrite the UnexpectedResponse.for_response function to include the URL data from the request (the request is an optional field on response which is used to construct the exception).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the send function in api_client.py and the UnexpectedResponse implementation in exceptions.py, especially UnexpectedResponse.for_response. Trace how the response request is available, then ensure the resulting exception includes the requested URL when one is present. Done means configuration errors show the server URL alongside the response details.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100