uhd-urz / elAPI

An extensible API client for eLabFTW
GNU Affero General Public License v3.0
5 stars 0 forks source link

Unsupported output format throws an error instead of actually falling back #16

Closed alexander-haller closed 2 months ago

alexander-haller commented 6 months ago

In GitLab by @mhxion on Mar 6, 2024, 16:48

The following command to get a list of all experiments in YAML format works as expected:

$ elapi get experiments --format yml

However, when the --format is invalid or unsupported instead of falling back to a predefined fallback format elapi throws a Python error with Python traceback. Though this behavior itself isn't too unusual, it was not intended. elAPI should just show the output format in fallback format.

$ elapi get experiments -F foo
ERROR    'foo' isn't a supported language format! Supported formats are: ['json', 'yaml', 'txt'].                                   
INFO     elapi will fallback to 'txt' format.                                                                                       

<Python traceback>

ValueError: 'foo' isn't a supported language format! Supported formats are: ['json', 'yaml', 'txt'].
alexander-haller commented 5 months ago

In GitLab by @mhxion on Mar 21, 2024, 02:06

Fixed in https://gitlab.urz.uni-heidelberg.de/urz-elabftw/elapi/-/merge_requests/32