aiidateam / aiida-restapi

AiiDA Web API for data queries and workflow management.
https://aiida-restapi.readthedocs.io
MIT License
10 stars 7 forks source link

Improve error message when submitting a process #41

Open sphuber opened 1 year ago

sphuber commented 1 year ago

Currently when submitting a process and the inputs are incorrect (for example label is missing, which shouldn't really even be required), the error message is not very useful. We simply get a

422 Unprocessable Entity
{'detail': [{'loc': ['body', 'label'], 'msg': 'field required', 'type': 'value_error.missing'}]}

It should ideally tell what data is missing.

sphuber commented 1 year ago

Turns out that the information is in the response, just hidden. In the example mentioned above, the label was missing. But maybe we can extract this from response['detail'][0]['loc'][-1] but not sure how fixed the format of this response is.

ltalirz commented 1 year ago

maybe a more generic printing of the detail field could do the trick?