Use the enum to display the error code and error type directly #3289
Labels
error handler
Issues related to the returned errors in Meilisearch
maintenance
Issue about maintenance (CI, tests, refacto...)
v1.0.0
PRs/issues solved in v1.0.0 released on 2023-02-06
Milestone
Currently, we represent all the possible error codes and types as enums in meilisearch;
meilisearch/meilisearch-types/src/error.rs
Lines 111 to 184 in ab655a8
But when we need to display them, instead of using their name, we write the implementation by hand instead of letting a tool like
serde_json
do it for us;meilisearch/meilisearch-types/src/error.rs
Lines 186 to 334 in ab655a8
That's very error-prone, not tested and could cause issues in the dump since we need to deserialize the string by hand once again to try to get the original enum.
We then have to store
String
in the final type we give toactix-web
when we could keep our original types and ease everything.The text was updated successfully, but these errors were encountered: