argilla-io / argilla

Argilla is a collaboration tool for AI engineers and domain experts to build high-quality datasets
https://docs.argilla.io
Apache License 2.0
3.91k stars 368 forks source link

More descriptive Error messages #1961

Open dvsrepo opened 1 year ago

dvsrepo commented 1 year ago

Is your feature request related to a problem? Please describe. I'd like to have more descriptive error codes and messages. Right now we return message and error codes directly from the Server, and I think we should have more fine-grained error message.

As an example, this happens when you try to retrieve a dataset that doesn't exist (or cannot be found) using rg.load from the client:


NotFoundApiError: Argilla server returned an error with http status: 404
Error details: [{'code': 'argilla.api.errors::EntityNotFoundError', 'params': {'name': 'ner_descriptions_with_terms', 'type': 'ServiceDataset'}}]

Complete error trace:

--------------------------------------------------------------------------
NotFoundApiError                          Traceback (most recent call last)
<ipython-input-3-1ebd04571bcb> in <cell line: 1>()
----> 1 rg.load("ner_descriptions_with_terms")

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/argilla/client/api.py in wrapped_func(*args, **kwargs)
    678             @wraps(api_method)
    679             def wrapped_func(*args, **kwargs):
--> 680                 return func(*args, **kwargs)
    681 
    682         sign = signature(api_method)

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/argilla/client/api.py in load(*args, **kwargs)
    727 @api_wrapper(Api.load)
    728 def load(*args, **kwargs):
--> 729     return active_api().load(*args, **kwargs)
    730 
    731 

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/argilla/client/api.py in load(self, name, query, ids, limit, id_from, as_pandas)
    523             )
    524 
--> 525         response = datasets_api.get_dataset(client=self._client, name=name)
    526         task = response.parsed.task
    527 

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/argilla/client/sdk/datasets/api.py in get_dataset(client, name)
     42     )
     43 
---> 44     return _build_response(response=response, name=name)
     45 
     46 

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/argilla/client/sdk/datasets/api.py in _build_response(response, name)
     99             parsed=parsed_response,
    100         )
--> 101     return handle_response_error(response, dataset=name)

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/argilla/client/sdk/commons/errors_handler.py in handle_response_error(response, parse_response, **client_ctx)
     59         error_type = MethodNotAllowedApiError
     60 
---> 61     raise error_type(**error_args)

NotFoundApiError: Argilla server returned an error with http status: 404
Error details: [{'code': 'argilla.api.errors::EntityNotFoundError', 'params': {'name': 'ner_descriptions_with_terms', 'type': 'ServiceDataset'}}]
dvsrepo commented 1 year ago

In this case, the dataset existed but was not in the default namespace.

nataliaElv commented 1 year ago

Duplicate of #3223