meilisearch / meilisearch/meilisearch-java

Ensure the error handling are following the best practice

Open
#640 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
Java
Stars
245
Forks
152
PR merge metrics
No merged PRs in 30d

Description

⚠️ 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 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing error classes and their inheritance in this Java SDK, then compare the proposed categories with related issue 267. Determine which errors lack messages and which represent API or communication failures; done means all errors share the proposed base type and follow the agreed categorization.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.