#community-help

Improving Error Handling in Typesense Non-Compliant Documents

TLDR micha suggested enhancing error responses for non-compliant documents in typesense and suggested an exception property in the PHP client. Jason instructed them to document this in a Github issue.

Powered by Struct AI
5
20mo
Solved
Join the chat
May 11, 2022 (20 months ago)
micha
Photo of md5-acabeb270eee485e29143a208813eecc
micha
06:30 PM
Hey, one thing i would like to suggest is better handling of non-complient documents trying to add to an collection. For example: when developing and migrating a existing data that has some weird permutations on some fields - it would be helpful if typesense wouldn’t just respond with “Invalid field ‘foobar’” (i’m quoting the error from my head) but with something like “Invalid field ‘foobar’ for document $documentId: expected “string”, got array (value: [‘foo1’, ‘foo2’])“.
06:31
micha
06:31 PM
even more awesome would be if:
a) there would then also be a way to get this specific data as properties of the requestmalformed exception in the php client and maybe even
b) if it would be possible to accept the document but have it not indexed (not sure how good this suggestion really is :D)
06:33
micha
06:33 PM
That would have helped me a lot in the initial development because right now i have to explicit catch the exception and then also log the complete document to retroactively figure out which documents failed and why.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:37 PM
micha These are good suggestions. Could you open a Github issue to document these?
micha
Photo of md5-acabeb270eee485e29143a208813eecc
micha
06:37 PM
Sure thing!