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

Better Error Handling for invalid ID field

MurkyTheMurloc opened this issue · comments

Description
When using an invalid ID field inside a data object, server response with 200 instead of yelling at me that he can't update the data.

Basic example
So yesterday I had 5 hours of fun debugging my server because the data inside my Meilisearch db didn't update. So I looked at the docker container logs, but they were totally fine. Then I logged the response of await this.MEILISEARCH_DB.index(key).updateDocuments(data); but also there was no error, the response was 200 and all seemed fine. So a couple of hours later I could nail down on the ID field. My data contained a Id field with a graphql endpoint as value gid://Endpoint/Product/<id>. So this is totally my mistake but better Error handling could saved me some debugging time.

Other
In generell I want to thank you for your awesome work so far I really enjoy working with Meilisearch :)

Hi @MurkyTheMurloc, sorry to hear about that debugging time :/

We try to extensively document the nature of being async in the docs and around the primary key of your documents...
Usually, the task response should work 200 OK, but what really matters is after that where you can see what happened with your request.

In any case, if you think it is useful, you could push a discussion further here https://github.com/orgs/meilisearch/discussions where you can give some examples of how that could be better implemented.

Thanks a lot for using Meilisearch and for taking the time on giving this feedback!