-
Notifications
You must be signed in to change notification settings - Fork 15
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
Reviewing of error handling #267
Comments
I have a general question for some additional context. Have people reported issues with the current errors? I haven't seen any. I'm trying to think of a time when this would be an issue. Taking the I'm just wondering if making a change will add a lot of extra maintenance for not much benefit. |
Hi @sanders41, |
I think this option is the best:
About For the |
I've opened issues in each repository, and I will close this issue now. I believe this change could be beneficial for the consumers and for the maintainers, since it is going to ensure a concise public API regarding the errors and will make things easier when you try to catch errors in the test suite. |
Warm up:
The aim of this issue is to detail the basic requirements of the SDK's error handlers, provide a brief refresher, and to question its implementation with the possibility of modifying or improving it.
This issue is created keeping in mind this one that defined the implementation of error handlers.
Reminder:
Meilisearch is an API with which the SDKs communicate via the HTTP protocol. Because of this, responses and therefore errors are returned through various HTTP statuses. The purpose of the error handler in the SDKs is to specify to the user that this error is returned by the package, therefore by Meilisearch that you are using. This is to increase visibility for the user amid other errors.
As specified in the central issue the SDKs should raise at minimum 3 errors:
Today, the API returns a certain number of errors for this status code:
These specific errors returned by the API have a certain format with a
type
, acode
, amessage
and alink
.Errors above 404 as well as certain errors between
400
and404
, do not have a specific error message. For example, if I query Meilisearch with an incorrect route, I will receive the error:404 Not found
. This is normal because the route does not exist, and Meilisearch cannot return a specific error. However, if I try to access an index that does not exist on the routelocalhost:7700/index/index_name
, I will also receive a404 Not found
error, but with this request body:Question:
The question at hand is whether all our errors are properly categorized according to the different codes chosen at the beginning or if this has changed.
The second issue is that as Meilisearch has more and more features and error messages based on different situations, we should separate the errors returned by the API when they do or do not contain a message.
Different possibilities
Keep as is
Transfer errors > 400 and without message to CommunicationError (I am not in favor of this solution)
Create a new error that is not a MeilisearchAPIError or that is a subclass of MeilisearchAPIError for errors with the API when a message is missing, for example, in these cases:
Create 2 new sub-errors within the MeilisearchAPIError category to handle errors with or without a message.
TODO:
MeilisearchError
which will extend the standard error if it does not exist (when the language supports)MeilisearchCommunicationError
since it is not a Meilisearch error anyway.The text was updated successfully, but these errors were encountered: