Skip to content
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

FunctionClauseError: Meilisearch.Error.cast/1 #22

Open
cwc opened this issue Dec 13, 2024 · 0 comments
Open

FunctionClauseError: Meilisearch.Error.cast/1 #22

cwc opened this issue Dec 13, 2024 · 0 comments

Comments

@cwc
Copy link

cwc commented Dec 13, 2024

We have occasionally encountered the following error in our application:

FunctionClauseError: no function clause matching in Meilisearch.Error.cast/1
  File "lib/meilisearch/error.ex", line 135, in Meilisearch.Error.cast/1
  File "lib/meilisearch/client.ex", line 58, in Meilisearch.Client.handle_response/1
  File "lib/meilisearch/search.ex", line 148, in Meilisearch.Search.search/3
  <snip>

It appears that for some reason, the body of the request to Meili is neither nil nor a map. I believe it is likely an error message - a binary - but there is no function clause for cast/1 in error.ex to handle this and return it to our application.

I believe this could be fixed by adding a clause to handle a binary body, by returning a Meilisearch.Error where the body is in the message key of the Error struct. I can open a PR to make this change if you like the idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant