Skip to content

Include message when Client Error is raised #60

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

Closed
jtmiclat opened this issue Apr 17, 2020 · 2 comments · Fixed by #82
Closed

Include message when Client Error is raised #60

jtmiclat opened this issue Apr 17, 2020 · 2 comments · Fixed by #82
Assignees

Comments

@jtmiclat
Copy link
Contributor

I was using the library and was getting 400 Client Error Exception: 400 Client Error: Bad Request for url:http....

I then had to use curl to read what the error was.

I think it would be nice to include the error message returned by Meilisearch for 400 error codes so users do not have to call the API using another library or tool to debug.

The relevant piece of code:

@staticmethod
def __validate(request):
try:
request.raise_for_status()
return HttpRequests.__to_json(request)
except requests.exceptions.HTTPError as err:
raise Exception(err)
except requests.exceptions.ConnectionError as err:
raise Exception(err)

@curquiza
Copy link
Member

curquiza commented Apr 18, 2020

Hi! You're totally right, it's not convenient for the moment! We indeed plan to do an error handler (#52) with clear error messages.
I link your issue to the previous one about the error handling 🙂

@eskombro
Copy link
Member

This will be handled very soon! this is going to significantly improve error handling in the whole MeiliSearch ecosystem, and it will of course improve our SDKs!

@curquiza curquiza linked a pull request May 28, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants