meilisearch / meilisearch-js

JavaScript client for the Meilisearch API

Home Page:https://www.meilisearch.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ensure the error handling are following the best practice

brunoocasali opened this issue · comments

⚠️ This issue is generated, it means the examples and the namings do not necessarily correspond to the language of this repository.
Also, if you are a maintainer, please add any clarification and instructions about this issue.

Sorry if this is already wholly/partially implemented. Feel free to let me know about the state of this issue in the repo.

Related to meilisearch/integration-guides#267


⚠️ For more information check meilisearch/integration-guides#267

Ensure this SDK follows the following guidelines:

  • All the errors > 400 without message should be sent as MeilisearchCommunicationError
  • Know errors like index is not found, or mistakes in the request like not-allowed params should be sent as MeilisearchApiError
  • Any other error should be a MeilisearchError

Essentially all the error should extend from MeilisearchError, the consumers should have a way to catch all the errors.
Let us know if this is not clear, or you have better idea!

TODO:

  • Create a base error called MeilisearchError which will extend the standard error if it does not exist (when the language supports)
  • Make all the other errors extend this error.
  • Move all errors without message to MeilisearchCommunicationError since it is not a Meilisearch error anyway.

MeilisearchError

class MeilisearchError extends Error {
constructor(message) {
super(message);
this.name = 'MeilisearchError';
}
}

Hey , Can I Solve these issues

Yes, just submit your PR with the fix :)

is this issue still open for fix?

Hello @Faizan711

Thanks for your interest in this project 🔥 You are definitely more than welcome to open a PR for this!

For your information, we prefer not assigning people to our issues because sometimes people ask to be assigned and never come back, which discourages the volunteer contributors from opening a PR to fix this issue.
We will accept and merge the first PR that fixes correctly and well implements the issue following our contributing guidelines.

We are looking forward to reviewing your PR 😊

Oh, thats great
So I will start to make changes