meilisearch-dart icon indicating copy to clipboard operation
meilisearch-dart copied to clipboard

Ensure the error handling are following the best practice

Open brunoocasali opened this issue 2 years ago • 2 comments
trafficstars

⚠️ 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 https://github.com/meilisearch/integration-guides/issues/267


:warning: For more information, check https://github.com/meilisearch/integration-guides/issues/267

Ensure this SDK follows the following guidelines:

  • All the errors > 400 without a 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 MeilisearchException

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

TODO:

  • [ ] Create a base error called MeilisearchException 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.

brunoocasali avatar Aug 14 '23 23:08 brunoocasali

@brunoocasali I suggest making it MeilisearchException instead of MeilisearchError

ahmednfwela avatar Sep 01 '23 09:09 ahmednfwela

Done! @ahmednfwela

brunoocasali avatar Sep 01 '23 12:09 brunoocasali