Description
Right now, there is no way to easily raise an exception for a failed task. When I use the built-in "wait for task" functionality, I'd like a way to get it to automatically raise an exception if the task I've waited for did not succeed. This could happen automatically as part of calling the method, or it could take the form of a raise_for_status()
method (like what the requests
library exposes on response objects).
The latter suggestion is complicated by the fact that right now, not all methods that return task data return the actual Task
object. Some of them return dictionaries while others return instances of the Task
class. I think this inconsistency would need to be addressed at the same time.
It is worth noting that the MeilisearchApiError
exception contains very similar fields to what is available in the error
data in the API task data. Unfortunately it also contains other information that make it difficult to easily re-use for the purpose I've described (a "failed task" exception).